Skip to content

Commit

Permalink
fix: managed package layouts do not export
Browse files Browse the repository at this point in the history
  • Loading branch information
Codeneos committed Aug 8, 2023
1 parent 6fc03b8 commit 6cad8d4
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as path from 'path';
import * as vscode from 'vscode';
import { unique} from '@vlocode/util';
import { DescribeGlobalSObjectResult, MetadataType, PackageManifest } from '@vlocode/salesforce';
import { FileProperties } from 'jsforce';
import { DescribeGlobalSObjectResult, FileProperties, MetadataType, PackageManifest } from '@vlocode/salesforce';
import MetadataCommand from './metadataCommand';
import { vscodeCommand } from '../../lib/commandRouter';
import { VlocodeCommand } from '../../constants';
Expand Down Expand Up @@ -37,8 +36,8 @@ export default class RetrieveMetadataCommand extends MetadataCommand {
}

return this.retrieveMetadata(componentToExport.map(item => ({
fullname: item.fullName,
componentType: metadataType.xmlName
fullname: this.getManifestName(item),
componentType: metadataType.name
})));
}

Expand Down Expand Up @@ -85,6 +84,14 @@ export default class RetrieveMetadataCommand extends MetadataCommand {
return metadataToExport?.type;
}

private getManifestName(component: FileProperties): string {
if (component.type === 'Layout' && component.namespacePrefix) {
const [ objectType, ...layout ] = component.fullName.split('-');
return `${objectType}-${component.namespacePrefix}__${layout.join('-')}`;
}
return component.fullName;
}

protected async retrieveMetadata(components: { fullname: string; componentType: string }[]) {
// Build manifest
const apiVersion = this.vlocode.config.salesforce?.apiVersion || this.salesforce.getApiVersion();
Expand Down

0 comments on commit 6cad8d4

Please sign in to comment.