Skip to content

Commit

Permalink
fix(@angular/cli): Fix config command setting number values
Browse files Browse the repository at this point in the history
fixes #10900
  • Loading branch information
Brocco authored and clydin committed May 29, 2018
1 parent 4f9fd9f commit 6d80c49
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/@angular/cli/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ function normalizeValue(value: string, path: string): JsonValue {
throw new Error(`Invalid value type; expected a ${cliOptionType}.`);
}

return parseJson(value, JsonParseMode.Loose);
if (typeof value === 'string') {
return parseJson(value, JsonParseMode.Loose);
}

return value;
}

export default class ConfigCommand extends Command {
Expand Down
8 changes: 8 additions & 0 deletions tests/e2e/tests/commands/config/config-set-serve-port.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { expectFileToMatch } from '../../../utils/fs';
import { ng } from '../../../utils/process';

export default function() {
return Promise.resolve()
.then(() => ng('config', 'projects.test-project.architect.serve.options.port', '1234'))
.then(() => expectFileToMatch('angular.json', /"port": 1234/));
}

0 comments on commit 6d80c49

Please sign in to comment.