diff --git a/src/RokuDeploy.spec.ts b/src/RokuDeploy.spec.ts index 67b7ad4..c7e3d5e 100644 --- a/src/RokuDeploy.spec.ts +++ b/src/RokuDeploy.spec.ts @@ -1821,6 +1821,21 @@ describe('index', () => { ]); }); + it('allows negating paths outside rootDir without requiring src;dest; syntax', async () => { + fsExtra.outputFileSync(`${rootDir}/../externalLib/source/lib.brs`, ''); + const filePaths = await getFilePaths([ + 'source/**/*', + { src: '../externalLib/**/*', dest: 'source' }, + '!../externalLib/source/**/*' + ], rootDir); + expect( + filePaths.map(x => s`${x.src}`).sort() + ).to.eql([ + s`${rootDir}/source/lib.brs`, + s`${rootDir}/source/main.brs` + ]); + }); + it('applies multi-glob paths relative to rootDir', async () => { expect(await getFilePaths([ 'manifest', @@ -2224,6 +2239,18 @@ describe('index', () => { ).to.be.undefined; }); + it('excludes file from non-rootdir top-level pattern', () => { + expect( + rokuDeploy.getDestPath( + s`${rootDir}/../externalDir/source/main.brs`, + [ + '!../externalDir/**/*' + ], + rootDir + ) + ).to.be.undefined; + }); + it('excludes a file that is negated in src;dest;', () => { expect( rokuDeploy.getDestPath( diff --git a/src/RokuDeploy.ts b/src/RokuDeploy.ts index 5f14b89..4cc8b83 100644 --- a/src/RokuDeploy.ts +++ b/src/RokuDeploy.ts @@ -192,6 +192,12 @@ export class RokuDeploy { //remove the ! so the glob will match properly if (isNegated) { src = src.substring(1); + //create the entry as a src;dest; so it doesn't throw that "Cannot reference a file outside of rootDir..." error in `getFilePathsForEntry`. + entry = { + src: src, + // Negated globs don't need a `dest` path but add the key to satisfy the typescript check + dest: undefined + }; } let entryResults = await this.getFilePathsForEntry(