Skip to content

Commit

Permalink
fix(nx): make target a required option when running affected npm script
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckyMaler authored and vsavkin committed Jul 7, 2019
1 parent 4297aef commit 83c1559
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/api-workspace/npmscripts/affected.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ Parallelize the command

### quiet

### target

Task to run for affected projects

### uncommitted

Uncommitted changes
Expand Down
12 changes: 11 additions & 1 deletion packages/workspace/src/command-line/nx-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const commandsObject = yargs
.command(
'affected',
'Run task for affected projects',
yargs => withAffectedOptions(withParallel(yargs)),
yargs => withAffectedOptions(withParallel(withTarget(yargs))),
args => affected(args)
)
.command(
Expand Down Expand Up @@ -247,3 +247,13 @@ function withParallel(yargs: yargs.Argv): yargs.Argv {
default: 3
});
}

function withTarget(yargs: yargs.Argv): yargs.Argv {
return yargs.option('target', {
describe: 'Task to run for affected projects',
type: 'string',
requiresArg: true,
demandOption: true,
global: false
});
}

0 comments on commit 83c1559

Please sign in to comment.