Skip to content

Commit 6d80c49

Browse files
Broccoclydin
authored andcommitted
fix(@angular/cli): Fix config command setting number values
fixes #10900
1 parent 4f9fd9f commit 6d80c49

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

packages/@angular/cli/commands/config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ function normalizeValue(value: string, path: string): JsonValue {
151151
throw new Error(`Invalid value type; expected a ${cliOptionType}.`);
152152
}
153153

154-
return parseJson(value, JsonParseMode.Loose);
154+
if (typeof value === 'string') {
155+
return parseJson(value, JsonParseMode.Loose);
156+
}
157+
158+
return value;
155159
}
156160

157161
export default class ConfigCommand extends Command {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { expectFileToMatch } from '../../../utils/fs';
2+
import { ng } from '../../../utils/process';
3+
4+
export default function() {
5+
return Promise.resolve()
6+
.then(() => ng('config', 'projects.test-project.architect.serve.options.port', '1234'))
7+
.then(() => expectFileToMatch('angular.json', /"port": 1234/));
8+
}

0 commit comments

Comments
 (0)