From 3d91d148a5d35ab97c7a8f5f261059524c3bf711 Mon Sep 17 00:00:00 2001 From: jayree Date: Thu, 23 May 2024 16:54:49 +0200 Subject: [PATCH] fix(snapshot): correction of the compare results --- lib/commands/jayree/project/compare/snapshot.js | 12 ++++++++---- .../jayree/project/compare/snapshot.js.map | 2 +- lib/commands/jayree/project/generate/snapshot.js | 2 +- .../jayree/project/generate/snapshot.js.map | 2 +- lib/utils/parse.d.ts | 2 +- lib/utils/parse.js | 16 ++++++++++------ lib/utils/parse.js.map | 2 +- src/commands/jayree/project/compare/snapshot.ts | 11 +++++++---- 8 files changed, 30 insertions(+), 19 deletions(-) diff --git a/lib/commands/jayree/project/compare/snapshot.js b/lib/commands/jayree/project/compare/snapshot.js index 5c4d2c56..7019ab0e 100644 --- a/lib/commands/jayree/project/compare/snapshot.js +++ b/lib/commands/jayree/project/compare/snapshot.js @@ -29,11 +29,15 @@ export default class CompareSourceSnapshot extends SfCommand { async run() { const { flags } = await this.parse(CompareSourceSnapshot); const orig = (await fs.readJSON(flags.filepath)); - const results = await getParsedSourceComponents(this.project?.getPath()); + const results = await getParsedSourceComponents(this.project?.getUniquePackageDirectories().map((pDir) => pDir.fullPath), this.project?.getPath()); const diff = detailedDiff(orig, results); - const addedMetadata = Object.keys(diff.added); - const removedMetadata = Object.keys(diff.deleted); - const modifiedMetadata = Object.keys(diff.updated); + const addedMetadata = Object.keys(diff.added).filter((k) => !(k in orig)); + const removedMetadata = Object.keys(diff.deleted).filter((k) => !(k in results)); + const modifiedMetadata = [ + ...Object.keys(diff.updated), + ...Object.keys(diff.added).filter((k) => k in orig), + ...Object.keys(diff.deleted).filter((k) => k in results), + ].filter((value, index, self) => self.indexOf(value) === index); if (addedMetadata.length === 0 && removedMetadata.length === 0 && modifiedMetadata.length === 0) { this.log('No changes have been detected.'); return {}; diff --git a/lib/commands/jayree/project/compare/snapshot.js.map b/lib/commands/jayree/project/compare/snapshot.js.map index 62b14cd5..6697acb3 100644 --- a/lib/commands/jayree/project/compare/snapshot.js.map +++ b/lib/commands/jayree/project/compare/snapshot.js.map @@ -1 +1 @@ -{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../../../src/commands/jayree/project/compare/snapshot.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;AAQhF,qDAAqD;AACrD,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,SAA0B;IACpE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAEzD,MAAM,CAAU,KAAK,GAAG;QAC7B,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;YACrB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC;YACtD,OAAO,EAAE,6BAA6B;SACvC,CAAC;KACH,CAAC;IAEK,MAAM,CAAU,eAAe,GAAG,IAAI,CAAC;IAEvC,MAAM,CAAU,gBAAgB,GAAG,IAAI,CAAC;IACxC,MAAM,CAAU,OAAO,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAEpE,4DAA4D;IACrD,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,qB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CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,gGAAgG,CAAC,CAAC;QAEpH,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC;IAC9D,CAAC"} \ No newline at end of file diff --git a/lib/commands/jayree/project/generate/snapshot.js b/lib/commands/jayree/project/generate/snapshot.js index b94cd43c..548526f1 100644 --- a/lib/commands/jayree/project/generate/snapshot.js +++ b/lib/commands/jayree/project/generate/snapshot.js @@ -24,7 +24,7 @@ export default class GenerateSourceSnapshot extends SfCommand { static aliases = ['jayree:source:snapshot:generate']; async run() { const { flags } = await this.parse(GenerateSourceSnapshot); - const results = await getParsedSourceComponents(this.project?.getPath()); + const results = await getParsedSourceComponents(this.project?.getUniquePackageDirectories().map((pDir) => pDir.fullPath), this.project?.getPath()); await fs.writeJSON(flags.filepath, results, { spaces: 4 }); this.log(`Generated snapshot file "${flags.filepath}"`); return results; diff --git a/lib/commands/jayree/project/generate/snapshot.js.map b/lib/commands/jayree/project/generate/snapshot.js.map index 785ca8cb..de5c513c 100644 --- a/lib/commands/jayree/project/generate/snapshot.js.map +++ b/lib/commands/jayree/project/generate/snapshot.js.map @@ -1 +1 @@ -{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../../../src/commands/jayree/project/generate/snapshot.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,UAAU,CAAC,CAAC;AAEjF,qDAAqD;AACrD,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,SAAkB;IAC7D,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAEzD,MAAM,CAAU,KAAK,GAAG;QAC7B,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;YACrB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC;YACtD,OAAO,EAAE,6BAA6B;SACvC,CAAC;KACH,CAAC;IAEK,MAAM,CAAU,eAAe,GAAG,IAAI,CAAC;IAEvC,MAAM,CAAU,gBAAgB,GAAG,IAAI,CAAC;IACxC,MAAM,CAAU,OAAO,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAE9D,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAE3D,MAAM,OAAO,GAAG,MAAM,yBAAyB,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAEzE,MAAM,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,GAAG,CAAC,4BAA4B,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;QACxD,OAAO,OAAO,CAAC;IACjB,CAAC"} \ No newline at end of file +{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../../../src/commands/jayree/project/generate/snapshot.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,O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ACxD,OAAO,OAAO,CAAC;IACjB,CAAC"} \ No newline at end of file diff --git a/lib/utils/parse.d.ts b/lib/utils/parse.d.ts index 98660bb6..da58f3b6 100644 --- a/lib/utils/parse.d.ts +++ b/lib/utils/parse.d.ts @@ -1,4 +1,4 @@ import { JsonMap } from '@salesforce/ts-types'; -export declare function getParsedSourceComponents(projectPath: string | undefined): Promise<{ +export declare function getParsedSourceComponents(uniquePackageDirectories: string[] | undefined, projectPath: string | undefined): Promise<{ [key: string]: JsonMap; }>; diff --git a/lib/utils/parse.js b/lib/utils/parse.js index deb20374..0ee18f08 100644 --- a/lib/utils/parse.js +++ b/lib/utils/parse.js @@ -6,14 +6,18 @@ */ import { relative } from 'node:path'; import { ComponentSet } from '@salesforce/source-deploy-retrieve'; -export async function getParsedSourceComponents(projectPath) { - const componentSet = ComponentSet.fromSource(projectPath).getSourceComponents(); +export async function getParsedSourceComponents(uniquePackageDirectories, projectPath) { const results = {}; - for await (const component of componentSet) { - for await (const childComponent of component.getChildren()) { - results[relative(projectPath, childComponent.xml)] = await childComponent.parseXml(); + if (uniquePackageDirectories) { + for await (const packageDirectory of uniquePackageDirectories) { + const componentSet = ComponentSet.fromSource(packageDirectory).getSourceComponents(); + for await (const component of componentSet) { + for await (const childComponent of component.getChildren()) { + results[relative(projectPath, childComponent.xml)] = await childComponent.parseXml(); + } + results[relative(projectPath, component.xml)] = await component.parseXml(); + } } - results[relative(projectPath, component.xml)] = await component.parseXml(); } return results; } diff --git a/lib/utils/parse.js.map b/lib/utils/parse.js.map index ef9be46c..eacc905f 100644 --- a/lib/utils/parse.js.map +++ b/lib/utils/parse.js.map @@ -1 +1 @@ -{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/utils/parse.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAGlE,MAAM,CAAC,KAAK,UA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AO,CAAC,QAAQ,CAAC,WAAqB,EAAE,cAAc,CAAC,GAAa,CAAC,CAAC,GAAG,MAAM,cAAc,CAAC,QAAQ,EAAE,CAAC;gBAC3G,CAAC;gBACD,OAAO,CAAC,QAAQ,CAAC,WAAqB,EAAE,SAAS,CAAC,GAAa,CAAC,CAAC,GAAG,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAC;YACjG,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/src/commands/jayree/project/compare/snapshot.ts b/src/commands/jayree/project/compare/snapshot.ts index ae6a0451..d3cba093 100644 --- a/src/commands/jayree/project/compare/snapshot.ts +++ b/src/commands/jayree/project/compare/snapshot.ts @@ -49,10 +49,13 @@ export default class CompareSourceSnapshot extends SfCommand { ); const diff = detailedDiff(orig, results) as { added: object; deleted: object; updated: object }; - - const addedMetadata = Object.keys(diff.added); - const removedMetadata = Object.keys(diff.deleted); - const modifiedMetadata = Object.keys(diff.updated); + const addedMetadata = Object.keys(diff.added).filter((k) => !(k in orig)); + const removedMetadata = Object.keys(diff.deleted).filter((k) => !(k in results)); + const modifiedMetadata = [ + ...Object.keys(diff.updated), + ...Object.keys(diff.added).filter((k) => k in orig), + ...Object.keys(diff.deleted).filter((k) => k in results), + ].filter((value, index, self) => self.indexOf(value) === index); if (addedMetadata.length === 0 && removedMetadata.length === 0 && modifiedMetadata.length === 0) { this.log('No changes have been detected.');