Skip to content

Commit 8e69b3b

Browse files
Broccofilipesilva
authored andcommitted
fix(@angular/cli): Fix config command setting number values
fixes #10900
1 parent 8563099 commit 8e69b3b

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
@@ -149,7 +149,11 @@ function normalizeValue(value: string, path: string): JsonValue {
149149
throw new Error(`Invalid value type; expected a ${cliOptionType}.`);
150150
}
151151

152-
return parseJson(value, JsonParseMode.Loose);
152+
if (typeof value === 'string') {
153+
return parseJson(value, JsonParseMode.Loose);
154+
}
155+
156+
return value;
153157
}
154158

155159
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)