diff --git a/CODEOWNERS b/CODEOWNERS index 11c671f..bc2c5fb 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,6 +1,8 @@ +* @salesforcecli/metadata-intelligence + # Techical writers will be added as reviewers on markdown changes. *.md @salesforcecli/cli-docs # Comment line immediately above ownership line is reserved for related other information. Please be careful while editing. #ECCN:Open Source -#GUSINFO:Open Source,Open Source Workflow \ No newline at end of file +#GUSINFO:Metadata Intelligence,Metadata Delivery \ No newline at end of file diff --git a/README.md b/README.md index 0440e14..3100aa9 100644 --- a/README.md +++ b/README.md @@ -102,9 +102,7 @@ DESCRIPTION This command currently supports the following metadata types: - LightningComponentBundle - - FlexiPage - CustomObject - - LightningTypeBundle Your org must be eligible for metadata enrichment. Your Salesforce admin can help with that. diff --git a/messages/errors.md b/messages/errors.md index defc715..2013446 100644 --- a/messages/errors.md +++ b/messages/errors.md @@ -2,10 +2,6 @@ Component not found in project. -# errors.lwc.only - -Only Lightning Web Components are currently supported for enrichment. - # errors.lwc.configuration.not.found The Lightning Web Component configuration file doesn't exist (\*.js-meta.xml). diff --git a/messages/metadata.enrich.md b/messages/metadata.enrich.md index 9bd942c..2ee4f55 100644 --- a/messages/metadata.enrich.md +++ b/messages/metadata.enrich.md @@ -15,9 +15,7 @@ Even though this command updates only local files in your DX project, you're sti This command currently supports the following metadata types: - LightningComponentBundle -- FlexiPage - CustomObject -- LightningTypeBundle Your org must be eligible for metadata enrichment. Your Salesforce admin can help with that. diff --git a/package.json b/package.json index da47475..37d15fb 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "@oclif/table": "^0.5.1", "@salesforce/core": "^8.24.3", "@salesforce/kit": "^3.2.4", - "@salesforce/metadata-enrichment": "^0.0.14", + "@salesforce/metadata-enrichment": "^0.0.15", "@salesforce/sf-plugins-core": "^12", "@salesforce/source-deploy-retrieve": "^12.31.14" }, diff --git a/src/commands/metadata/enrich.ts b/src/commands/metadata/enrich.ts index 75a1b52..6ebd50c 100644 --- a/src/commands/metadata/enrich.ts +++ b/src/commands/metadata/enrich.ts @@ -18,7 +18,13 @@ import { MultiStageOutput } from '@oclif/multi-stage-output'; import { Messages, SfProject } from '@salesforce/core'; import { Flags, SfCommand, Ux } from '@salesforce/sf-plugins-core'; import { ComponentSetBuilder } from '@salesforce/source-deploy-retrieve'; -import { SourceComponentProcessor, EnrichmentHandler, EnrichmentMetrics, EnrichmentRecords, FileProcessor } from '@salesforce/metadata-enrichment'; +import { + SourceComponentProcessor, + EnrichmentHandler, + EnrichmentMetrics, + EnrichmentRecords, + FileProcessor, +} from '@salesforce/metadata-enrichment'; Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); const commandMessages = Messages.loadMessages('@salesforce/plugin-metadata-enrichment', 'metadata.enrich'); @@ -49,7 +55,7 @@ export default class MetadataEnrich extends SfCommand { const STAGES_MSO = [ commandMessages.getMessage('stage.setup'), - commandMessages.getMessage('stage.executing'), + commandMessages.getMessage('stage.executing'), commandMessages.getMessage('stage.updating.files'), ]; diff --git a/test/unit/componentProcessor.test.ts b/test/unit/componentProcessor.test.ts index c8a0f97..a84a4cc 100644 --- a/test/unit/componentProcessor.test.ts +++ b/test/unit/componentProcessor.test.ts @@ -36,37 +36,55 @@ describe('ComponentProcessor', () => { it('should return empty set when requested LWC exists in source with xml', () => { const source = [createSourceComponent('MyCmp', 'LightningComponentBundle', { xml: 'mycmp.js-meta.xml' })]; - const result = SourceComponentProcessor.getComponentsToSkip(source, ['LightningComponentBundle:MyCmp'], undefined); + const result = SourceComponentProcessor.getComponentsToSkip( + source, + ['LightningComponentBundle:MyCmp'], + undefined + ); expect(result.size).to.equal(0); }); it('should include requested component when not in source (missing)', () => { const source = [createSourceComponent('OtherCmp', 'LightningComponentBundle', { xml: 'other.js-meta.xml' })]; - const result = SourceComponentProcessor.getComponentsToSkip(source, ['LightningComponentBundle:MissingCmp'], undefined); + const result = SourceComponentProcessor.getComponentsToSkip( + source, + ['LightningComponentBundle:MissingCmp'], + undefined + ); expect(result.size).to.be.greaterThan(0); const skipNames = Array.from(result).map((r) => r.componentName); expect(skipNames).to.include('MissingCmp'); }); - it('should include non-LWC component in skip set', () => { - const source = [createSourceComponent('MyClass', 'ApexClass')]; - const result = SourceComponentProcessor.getComponentsToSkip(source, ['ApexClass:MyClass'], undefined); + it('should include requested CustomObject in skip set when missing from source', () => { + const source = [createSourceComponent('OtherObject', 'CustomObject')]; + const result = SourceComponentProcessor.getComponentsToSkip(source, ['CustomObject:MissingObject'], undefined); expect(result.size).to.be.greaterThan(0); - const skipEntries = Array.from(result); - expect(skipEntries.some((r) => r.componentName === 'MyClass' && r.componentType.name === 'ApexClass')).to.be.true; + const skipNames = Array.from(result).map((r) => r.componentName); + expect(skipNames).to.include('MissingObject'); }); it('should include LWC without xml in skip set', () => { const source = [createSourceComponent('NoMetaCmp', 'LightningComponentBundle')]; - const result = SourceComponentProcessor.getComponentsToSkip(source, ['LightningComponentBundle:NoMetaCmp'], undefined); + const result = SourceComponentProcessor.getComponentsToSkip( + source, + ['LightningComponentBundle:NoMetaCmp'], + undefined + ); expect(result.size).to.be.greaterThan(0); expect(Array.from(result).some((r) => r.componentName === 'NoMetaCmp')).to.be.true; }); - it('should not include wildcard metadata entries in requested (no missing from wildcard)', () => { + it('should not parse wildcard as an entry for LWC components to skip', () => { const source: SourceComponent[] = []; const result = SourceComponentProcessor.getComponentsToSkip(source, ['LightningComponentBundle:*'], undefined); expect(result.size).to.equal(0); }); + + it('should not parse wildcard as an entry for CustomObject components to skip', () => { + const source: SourceComponent[] = []; + const result = SourceComponentProcessor.getComponentsToSkip(source, ['CustomObject:*'], undefined); + expect(result.size).to.equal(0); + }); }); });