From 4b25685c0d30cf7ebe9a622abbc4c6c1890ebf54 Mon Sep 17 00:00:00 2001 From: william-xie Date: Fri, 17 Apr 2026 15:47:23 -0700 Subject: [PATCH 1/4] fix: remove unsupported metadata types --- README.md | 4 +-- messages/errors.md | 4 --- messages/metadata.enrich.md | 4 +-- src/commands/metadata/enrich.ts | 12 +++++++-- test/unit/componentProcessor.test.ts | 40 ++++++++++++++++++++++------ test/unit/enrich.test.ts | 26 ++++++++++++++++++ 6 files changed, 70 insertions(+), 20 deletions(-) create mode 100644 test/unit/enrich.test.ts diff --git a/README.md b/README.md index 0440e14..ecdd26c 100644 --- a/README.md +++ b/README.md @@ -101,10 +101,8 @@ DESCRIPTION This command currently supports the following metadata types: - - LightningComponentBundle - - FlexiPage - CustomObject - - LightningTypeBundle + - LightningComponentBundle 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..76588bc 100644 --- a/messages/metadata.enrich.md +++ b/messages/metadata.enrich.md @@ -14,10 +14,8 @@ 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 +- LightningComponentBundle Your org must be eligible for metadata enrichment. Your Salesforce admin can help with that. diff --git a/src/commands/metadata/enrich.ts b/src/commands/metadata/enrich.ts index 75a1b52..f01a642 100644 --- a/src/commands/metadata/enrich.ts +++ b/src/commands/metadata/enrich.ts @@ -18,12 +18,20 @@ 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'); const metricsMessages = Messages.loadMessages('@salesforce/plugin-metadata-enrichment', 'metrics'); +export const SUPPORTED_METADATA_TYPES = ['CustomObject', 'LightningComponentBundle'] as const; + export default class MetadataEnrich extends SfCommand { public static readonly summary = commandMessages.getMessage('summary'); public static readonly description = commandMessages.getMessage('description'); @@ -49,7 +57,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..cb13cae 100644 --- a/test/unit/componentProcessor.test.ts +++ b/test/unit/componentProcessor.test.ts @@ -36,37 +36,61 @@ 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 return empty set when requested CustomObject exists in source with xml', () => { + const source = [createSourceComponent('MyObject', 'CustomObject', { xml: 'MyObject.object-meta.xml' })]; + const result = SourceComponentProcessor.getComponentsToSkip(source, ['CustomObject:MyObject'], undefined); + expect(result.size).to.equal(0); + }); + it('should not include wildcard metadata entries in requested (no missing from wildcard)', () => { const source: SourceComponent[] = []; const result = SourceComponentProcessor.getComponentsToSkip(source, ['LightningComponentBundle:*'], undefined); expect(result.size).to.equal(0); }); + + it('should not include wildcard CustomObject entries in requested (no missing from wildcard)', () => { + const source: SourceComponent[] = []; + const result = SourceComponentProcessor.getComponentsToSkip(source, ['CustomObject:*'], undefined); + expect(result.size).to.equal(0); + }); }); }); diff --git a/test/unit/enrich.test.ts b/test/unit/enrich.test.ts new file mode 100644 index 0000000..dcb717a --- /dev/null +++ b/test/unit/enrich.test.ts @@ -0,0 +1,26 @@ +/* + * Copyright 2026, Salesforce, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { expect } from 'chai'; +import { SUPPORTED_METADATA_TYPES } from '../../src/commands/metadata/enrich.js'; + +describe('MetadataEnrich', () => { + describe('SUPPORTED_METADATA_TYPES', () => { + it('should contain exactly CustomObject and LightningComponentBundle', () => { + expect(SUPPORTED_METADATA_TYPES).to.deep.equal(['CustomObject', 'LightningComponentBundle']); + }); + }); +}); From ac7fb1b5dc628f952b39b7179355ee52f0c37d57 Mon Sep 17 00:00:00 2001 From: william-xie Date: Mon, 20 Apr 2026 13:10:03 -0700 Subject: [PATCH 2/4] remove unused supported metadata types const --- README.md | 2 +- messages/metadata.enrich.md | 2 +- src/commands/metadata/enrich.ts | 2 -- test/unit/enrich.test.ts | 26 -------------------------- 4 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 test/unit/enrich.test.ts diff --git a/README.md b/README.md index ecdd26c..3100aa9 100644 --- a/README.md +++ b/README.md @@ -101,8 +101,8 @@ DESCRIPTION This command currently supports the following metadata types: - - CustomObject - LightningComponentBundle + - CustomObject Your org must be eligible for metadata enrichment. Your Salesforce admin can help with that. diff --git a/messages/metadata.enrich.md b/messages/metadata.enrich.md index 76588bc..2ee4f55 100644 --- a/messages/metadata.enrich.md +++ b/messages/metadata.enrich.md @@ -14,8 +14,8 @@ Even though this command updates only local files in your DX project, you're sti This command currently supports the following metadata types: -- CustomObject - LightningComponentBundle +- CustomObject Your org must be eligible for metadata enrichment. Your Salesforce admin can help with that. diff --git a/src/commands/metadata/enrich.ts b/src/commands/metadata/enrich.ts index f01a642..6ebd50c 100644 --- a/src/commands/metadata/enrich.ts +++ b/src/commands/metadata/enrich.ts @@ -30,8 +30,6 @@ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); const commandMessages = Messages.loadMessages('@salesforce/plugin-metadata-enrichment', 'metadata.enrich'); const metricsMessages = Messages.loadMessages('@salesforce/plugin-metadata-enrichment', 'metrics'); -export const SUPPORTED_METADATA_TYPES = ['CustomObject', 'LightningComponentBundle'] as const; - export default class MetadataEnrich extends SfCommand { public static readonly summary = commandMessages.getMessage('summary'); public static readonly description = commandMessages.getMessage('description'); diff --git a/test/unit/enrich.test.ts b/test/unit/enrich.test.ts deleted file mode 100644 index dcb717a..0000000 --- a/test/unit/enrich.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2026, Salesforce, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { expect } from 'chai'; -import { SUPPORTED_METADATA_TYPES } from '../../src/commands/metadata/enrich.js'; - -describe('MetadataEnrich', () => { - describe('SUPPORTED_METADATA_TYPES', () => { - it('should contain exactly CustomObject and LightningComponentBundle', () => { - expect(SUPPORTED_METADATA_TYPES).to.deep.equal(['CustomObject', 'LightningComponentBundle']); - }); - }); -}); From dd47ca9ae40289d298deb538c1583fb3f79085ca Mon Sep 17 00:00:00 2001 From: william-xie Date: Mon, 20 Apr 2026 13:13:16 -0700 Subject: [PATCH 3/4] bump metadata-enrichment library version and clarify test scenario name --- package.json | 2 +- test/unit/componentProcessor.test.ts | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) 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/test/unit/componentProcessor.test.ts b/test/unit/componentProcessor.test.ts index cb13cae..a84a4cc 100644 --- a/test/unit/componentProcessor.test.ts +++ b/test/unit/componentProcessor.test.ts @@ -75,19 +75,13 @@ describe('ComponentProcessor', () => { expect(Array.from(result).some((r) => r.componentName === 'NoMetaCmp')).to.be.true; }); - it('should return empty set when requested CustomObject exists in source with xml', () => { - const source = [createSourceComponent('MyObject', 'CustomObject', { xml: 'MyObject.object-meta.xml' })]; - const result = SourceComponentProcessor.getComponentsToSkip(source, ['CustomObject:MyObject'], undefined); - expect(result.size).to.equal(0); - }); - - 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 include wildcard CustomObject entries in requested (no missing from wildcard)', () => { + 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); From 0ee3d7749ff1c02f19bfa0f85dd9afd598b06524 Mon Sep 17 00:00:00 2001 From: william-xie Date: Tue, 21 Apr 2026 16:23:11 -0700 Subject: [PATCH 4/4] fix: update CODEOWNERS --- CODEOWNERS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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