Skip to content

Commit

Permalink
Merge pull request #372 from spotify/fix-positional-arg-issue
Browse files Browse the repository at this point in the history
fix(web-scripts): positional args were being stripped out
  • Loading branch information
Paul Marbach committed May 21, 2020
2 parents 858f863 + aa74fc1 commit e1af1bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 9 additions & 13 deletions packages/web-scripts/src/index.ts
Expand Up @@ -62,7 +62,7 @@ program
esm,
types,
cjs,
restOptions: parseRestOptions(cmd),
restOptions: cmd.args,
};

handlePromiseResult(buildTask(t));
Expand All @@ -79,7 +79,7 @@ program
const t: TestTaskDesc = {
name: 'test',
config,
restOptions: parseRestOptions(cmd),
restOptions: cmd.args,
};

const result = testTask(t);
Expand All @@ -103,7 +103,7 @@ program
config,
stylecheck,
typecheck,
restOptions: parseRestOptions(cmd),
restOptions: cmd.args,
};

handlePromiseResult(lintTask(t));
Expand All @@ -125,7 +125,7 @@ program
name: 'format',
config,
path,
restOptions: parseRestOptions(cmd),
restOptions: cmd.args,
};

handleSpawnResult(formatTask(t));
Expand Down Expand Up @@ -156,7 +156,7 @@ program
jestConfig,
eslintConfig,
prettierConfig,
restOptions: parseRestOptions(cmd),
restOptions: cmd.args,
};

handlePromiseResult(precommitTask(t));
Expand Down Expand Up @@ -194,7 +194,7 @@ program
const t: AuditTaskDesc = {
name: 'audit',
threshold,
restOptions: parseRestOptions(cmd),
restOptions: cmd.args,
};

handlePromiseResult(auditTask(t));
Expand All @@ -215,7 +215,7 @@ program
const t: CommitTaskDesc = {
name: 'commit',
path,
restOptions: parseRestOptions(cmd),
restOptions: cmd.args,
};

try {
Expand All @@ -240,7 +240,7 @@ program
const t: CommitMsgTaskDesc = {
name: 'commitmsg',
config,
restOptions: parseRestOptions(cmd),
restOptions: cmd.args,
};

handleSpawnResult(commitMsgTask(t));
Expand All @@ -254,7 +254,7 @@ program
const cmd = getCommand(args);
const t: ReleaseTaskDesc = {
name: 'release',
restOptions: parseRestOptions(cmd),
restOptions: cmd.args,
};

handleSpawnResult(releaseTask(t));
Expand Down Expand Up @@ -292,10 +292,6 @@ function getOpts(cmd: Command): { [key: string]: any } {
return cmd.opts();
}

function parseRestOptions(cmd: Command): string[] {
return cmd.parseOptions(process.argv).unknown;
}

program.parse(process.argv);

if (!process.argv.slice(2).length) {
Expand Down
2 changes: 2 additions & 0 deletions packages/web-scripts/src/integration.test.ts
Expand Up @@ -92,6 +92,7 @@ describe('integration tests', () => {
);
}, SETUP_REPO_TIMEOUT);

// eslint-disable-next-line jest/expect-expect
test(
'Full integration test',
async () => await testScripts(),
Expand All @@ -109,6 +110,7 @@ describe('integration tests', () => {
);
}, SETUP_REPO_TIMEOUT);

// eslint-disable-next-line jest/expect-expect
test(
'Full integration test',
async () => await testScripts(['--no-types'], ['--no-typecheck']),
Expand Down

0 comments on commit e1af1bf

Please sign in to comment.