diff --git a/packages/core/src/package/diff/PackageDiffImpl.ts b/packages/core/src/package/diff/PackageDiffImpl.ts index 4584caf3e..356d9f3f8 100644 --- a/packages/core/src/package/diff/PackageDiffImpl.ts +++ b/packages/core/src/package/diff/PackageDiffImpl.ts @@ -73,7 +73,13 @@ export default class PackageDiffImpl { // Check whether the package has been modified for (let filename of modified_files) { - if (filename.includes(path.normalize(pkgDescriptor.path))) { + + let normalizedPkgPath = path.normalize(pkgDescriptor.path); + let normalizedFilename = path.normalize(filename); + + let relativePath = path.relative(normalizedPkgPath, normalizedFilename); + + if (!relativePath.startsWith('..')) { SFPLogger.log(`Found change(s) in ${filename}`, LoggerLevel.TRACE, this.logger); return { isToBeBuilt: true, reason: `Found change(s) in package`, tag: tag }; } diff --git a/packages/core/tests/package/PackageDiffImpl.test.ts b/packages/core/tests/package/PackageDiffImpl.test.ts index 781487743..69a44d44a 100644 --- a/packages/core/tests/package/PackageDiffImpl.test.ts +++ b/packages/core/tests/package/PackageDiffImpl.test.ts @@ -74,6 +74,11 @@ describe('Determines whether a given package has changed', () => { let result = await packageDiffImpl.exec(); expect(result.isToBeBuilt).toEqual(true); expect(result.reason).toEqual(`Found change(s) in package`); + + packageDiffImpl = new PackageDiffImpl(new ConsoleLogger(), 'core-b', null); + result = await packageDiffImpl.exec(); + expect(result.isToBeBuilt).toEqual(false); + }); it('should return true if package descriptor has changed', async () => { @@ -187,6 +192,18 @@ const packageConfigJson: string = ` "PermSetC" ] }, + { + "path": "packages/domains/core-b", + "package": "core-b", + "default": false, + "versionName": "covax", + "versionNumber": "1.0.0.0", + "assignPermSetsPreDeployment": [ + "PermSetA", + "PermSetB", + "PermSetC" + ] + }, { "path": "packages/frameworks/mass-dataload", "package": "mass-dataload",