Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow negated non-root-dir top-level patterns in files array #78

Merged
merged 24 commits into from
Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4883c84
standardize unit tests and remove testProject
TwitchBronBron Oct 22, 2021
38a9ec5
Upgrade typescript and test packages.
TwitchBronBron Oct 22, 2021
67a4cb7
Merge branch 'dev-package-upgrades' into unit-test-cleanup
TwitchBronBron Oct 22, 2021
6f01a4b
Merge branch 'master' of https://github.com/rokucommunity/roku-deploy…
TwitchBronBron Oct 22, 2021
e867bce
Upgrade eslint and fix some lint issues.
TwitchBronBron Oct 22, 2021
d3250a0
Bump node version for CI
TwitchBronBron Oct 22, 2021
828d812
Remove unnecessary ts-mocha
TwitchBronBron Oct 22, 2021
3e6d800
silly fix
TwitchBronBron Oct 22, 2021
fb500f8
Merge branch 'more-dev-package-fixes' into unit-test-cleanup
TwitchBronBron Oct 22, 2021
22c6fb6
Hit 100% coverage
TwitchBronBron Oct 22, 2021
d7b8c58
fix cwd issue
TwitchBronBron Oct 22, 2021
4763a83
Try to fix build
TwitchBronBron Oct 23, 2021
b4220a7
Remove unused eventemitter3
TwitchBronBron Oct 23, 2021
b9fe63d
Close signed package write stream
TwitchBronBron Oct 23, 2021
5a2eb6f
Fix test that was using testProject
TwitchBronBron Oct 23, 2021
73049e3
Fix device tests
TwitchBronBron Oct 23, 2021
611d2fa
Remove testProject
TwitchBronBron Oct 23, 2021
e1c84a7
Remove `as any` casts in tests
TwitchBronBron Oct 23, 2021
6804053
Fix rekey package path
TwitchBronBron Oct 23, 2021
ac7dc59
Fix more tests.
TwitchBronBron Oct 23, 2021
3ee31ca
Allow outside-rootDir negated top-level globs
TwitchBronBron Oct 21, 2021
4f967b6
Fix test
TwitchBronBron Oct 25, 2021
b515ca1
Merge branch 'master' of https://github.com/rokucommunity/roku-deploy…
TwitchBronBron Oct 25, 2021
1dbde11
Merge branch 'master' into feat/outside-rootDir-negated-globs
TwitchBronBron Oct 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/RokuDeploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 6 additions & 0 deletions src/RokuDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down