Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ab943ae

Browse files
HotellFrozenPandaz
authored andcommittedSep 11, 2020
fix(core): remove invalid --plain flags from affected commands
ISSUES CLOSED: 2720
1 parent cfb9718 commit ab943ae

21 files changed

+18
-81
lines changed
 

Diff for: ‎docs/angular/cli/affected-build.md

-4
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ Default: `false`
110110

111111
Parallelize the command
112112

113-
### plain
114-
115-
Produces a plain output for affected:apps and affected:libs
116-
117113
### runner
118114

119115
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/angular/cli/affected-dep-graph.md

-4
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ Default: `false`
9292

9393
Isolate projects which previously failed
9494

95-
### plain
96-
97-
Produces a plain output for affected:apps and affected:libs
98-
9995
### runner
10096

10197
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/angular/cli/affected-e2e.md

-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ Default: `false`
9898

9999
Parallelize the command
100100

101-
### plain
102-
103-
Produces a plain output for affected:apps and affected:libs
104-
105101
### runner
106102

107103
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/angular/cli/affected-lint.md

-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ Default: `false`
9898

9999
Parallelize the command
100100

101-
### plain
102-
103-
Produces a plain output for affected:apps and affected:libs
104-
105101
### runner
106102

107103
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/angular/cli/affected-test.md

-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ Default: `false`
9898

9999
Parallelize the command
100100

101-
### plain
102-
103-
Produces a plain output for affected:apps and affected:libs
104-
105101
### runner
106102

107103
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/angular/cli/affected.md

-4
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ Default: `false`
116116

117117
Parallelize the command
118118

119-
### plain
120-
121-
Produces a plain output for affected:apps and affected:libs
122-
123119
### runner
124120

125121
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/angular/cli/format-check.md

-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ Default: `false`
5050

5151
Isolate projects which previously failed
5252

53-
### plain
54-
55-
Produces a plain output for affected:apps and affected:libs
56-
5753
### runner
5854

5955
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/angular/cli/format-write.md

-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ Default: `false`
5050

5151
Isolate projects which previously failed
5252

53-
### plain
54-
55-
Produces a plain output for affected:apps and affected:libs
56-
5753
### runner
5854

5955
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/angular/cli/print-affected.md

-4
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ Default: `false`
8686

8787
Isolate projects which previously failed
8888

89-
### plain
90-
91-
Produces a plain output for affected:apps and affected:libs
92-
9389
### runner
9490

9591
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/react/cli/affected-build.md

-4
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ Default: `false`
110110

111111
Parallelize the command
112112

113-
### plain
114-
115-
Produces a plain output for affected:apps and affected:libs
116-
117113
### runner
118114

119115
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/react/cli/affected-dep-graph.md

-4
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ Default: `false`
9292

9393
Isolate projects which previously failed
9494

95-
### plain
96-
97-
Produces a plain output for affected:apps and affected:libs
98-
9995
### runner
10096

10197
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/react/cli/affected-e2e.md

-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ Default: `false`
9898

9999
Parallelize the command
100100

101-
### plain
102-
103-
Produces a plain output for affected:apps and affected:libs
104-
105101
### runner
106102

107103
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/react/cli/affected-lint.md

-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ Default: `false`
9898

9999
Parallelize the command
100100

101-
### plain
102-
103-
Produces a plain output for affected:apps and affected:libs
104-
105101
### runner
106102

107103
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/react/cli/affected-test.md

-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ Default: `false`
9898

9999
Parallelize the command
100100

101-
### plain
102-
103-
Produces a plain output for affected:apps and affected:libs
104-
105101
### runner
106102

107103
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/react/cli/affected.md

-4
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ Default: `false`
116116

117117
Parallelize the command
118118

119-
### plain
120-
121-
Produces a plain output for affected:apps and affected:libs
122-
123119
### runner
124120

125121
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/react/cli/format-check.md

-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ Default: `false`
5050

5151
Isolate projects which previously failed
5252

53-
### plain
54-
55-
Produces a plain output for affected:apps and affected:libs
56-
5753
### runner
5854

5955
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/react/cli/format-write.md

-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ Default: `false`
5050

5151
Isolate projects which previously failed
5252

53-
### plain
54-
55-
Produces a plain output for affected:apps and affected:libs
56-
5753
### runner
5854

5955
This is the name of the tasks runner configured in nx.json

Diff for: ‎docs/react/cli/print-affected.md

-4
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ Default: `false`
8686

8787
Isolate projects which previously failed
8888

89-
### plain
90-
91-
Produces a plain output for affected:apps and affected:libs
92-
9389
### runner
9490

9591
This is the name of the tasks runner configured in nx.json

Diff for: ‎packages/workspace/src/command-line/affected.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { generateGraph } from './dep-graph';
33
import { output } from '../utils/output';
44
import { parseFiles } from './shared';
55
import { runCommand } from '../tasks-runner/run-command';
6-
import { NxArgs, splitArgsIntoNxArgsAndOverrides } from './utils';
6+
import { NxArgs, splitArgsIntoNxArgsAndOverrides, RawNxArgs } from './utils';
77
import { filterAffected } from '../core/affected-project-graph';
88
import {
99
createProjectGraph,
@@ -17,7 +17,10 @@ import { printAffected } from './print-affected';
1717
import { projectHasTarget } from '../utils/project-graph-utils';
1818
import { DefaultReporter } from '../tasks-runner/default-reporter';
1919

20-
export function affected(command: string, parsedArgs: yargs.Arguments): void {
20+
export function affected(
21+
command: 'apps' | 'libs' | 'dep-graph' | 'print-affected' | 'affected',
22+
parsedArgs: yargs.Arguments & RawNxArgs
23+
): void {
2124
const { nxArgs, overrides } = splitArgsIntoNxArgsAndOverrides(
2225
parsedArgs,
2326
'affected',

Diff for: ‎packages/workspace/src/command-line/nx-commands.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ export const commandsObject = yargs
5555
.command(
5656
'affected:apps',
5757
'Print applications affected by changes',
58-
withAffectedOptions,
58+
(yargs) => withAffectedOptions(withPlainOption(yargs)),
5959
(args) => affected('apps', { ...args })
6060
)
6161
.command(
6262
'affected:libs',
6363
'Print libraries affected by changes',
64-
withAffectedOptions,
64+
(yargs) => withAffectedOptions(withPlainOption(yargs)),
6565
(args) =>
6666
affected('libs', {
6767
...args,
@@ -205,6 +205,11 @@ function withPrintAffectedOptions(yargs: yargs.Argv): yargs.Argv {
205205
return yargs.option('select', { type: 'string' });
206206
}
207207

208+
function withPlainOption(yargs: yargs.Argv): yargs.Argv {
209+
return yargs.option('plain', {
210+
describe: 'Produces a plain output for affected:apps and affected:libs',
211+
});
212+
}
208213
function withAffectedOptions(yargs: yargs.Argv): yargs.Argv {
209214
return yargs
210215
.option('files', {
@@ -269,9 +274,6 @@ function withAffectedOptions(yargs: yargs.Argv): yargs.Argv {
269274
.option('verbose', {
270275
describe: 'Print additional error stack trace on failure',
271276
})
272-
.option('plain', {
273-
describe: 'Produces a plain output for affected:apps and affected:libs',
274-
})
275277
.conflicts({
276278
files: ['uncommitted', 'untracked', 'base', 'head', 'all'],
277279
untracked: ['uncommitted', 'files', 'base', 'head', 'all'],

Diff for: ‎packages/workspace/src/command-line/utils.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ const runAffected = [
3939
'select',
4040
];
4141

42+
export interface RawNxArgs extends NxArgs {
43+
prod?: boolean;
44+
}
45+
4246
export interface NxArgs {
4347
target?: string;
4448
configuration?: string;
@@ -78,12 +82,12 @@ export function splitArgsIntoNxArgsAndOverrides(
7882
const nxSpecific =
7983
mode === 'run-one' ? runOne : mode === 'run-many' ? runMany : runAffected;
8084

81-
const nxArgs: any = {};
85+
const nxArgs: RawNxArgs = {};
8286
const overrides = yargsParser(args._);
8387
delete overrides._;
8488

8589
Object.entries(args).forEach(([key, value]) => {
86-
if (nxSpecific.includes(key as any)) {
90+
if (nxSpecific.includes(key)) {
8791
nxArgs[key] = value;
8892
} else if (!ignoreArgs.includes(key)) {
8993
overrides[key] = value;

0 commit comments

Comments
 (0)
Please sign in to comment.