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 9699214

Browse files
committedAug 13, 2020
fix(core): override --prod with --configuration
1 parent 5109068 commit 9699214

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed
 

‎packages/cli/lib/parse-run-one-options.spec.ts

+34
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,40 @@ describe('parseRunOneOptions', () => {
1414
});
1515
});
1616

17+
it('should work with --prod', () => {
18+
expect(
19+
parseRunOneOptions(nxJson, workspaceJson, [
20+
'build',
21+
'myproj',
22+
'--prod',
23+
'--flag=true',
24+
])
25+
).toEqual({
26+
project: 'myproj',
27+
target: 'build',
28+
configuration: 'production',
29+
parsedArgs: { _: [], flag: 'true' },
30+
});
31+
});
32+
33+
it('should override --prod with --configuration', () => {
34+
expect(
35+
parseRunOneOptions(nxJson, workspaceJson, [
36+
'build',
37+
'myproj',
38+
'--prod',
39+
'--configuration',
40+
'dev',
41+
'--flag=true',
42+
])
43+
).toEqual({
44+
project: 'myproj',
45+
target: 'build',
46+
configuration: 'dev',
47+
parsedArgs: { _: [], flag: 'true' },
48+
});
49+
});
50+
1751
it('should work with run syntax', () => {
1852
expect(
1953
parseRunOneOptions(nxJson, workspaceJson, [

‎packages/cli/lib/parse-run-one-options.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ export function parseRunOneOptions(
4343

4444
if (parsedArgs.configuration) {
4545
configuration = parsedArgs.configuration;
46-
}
47-
if (parsedArgs.prod) {
46+
} else if (parsedArgs.prod) {
4847
configuration = 'production';
4948
}
5049
if (parsedArgs.project) {

0 commit comments

Comments
 (0)
Please sign in to comment.