Skip to content

Commit 9bdeebb

Browse files
Merge pull request #134 from angular/master
Update upstream
2 parents 28b46fc + 08623d5 commit 9bdeebb

File tree

10 files changed

+1890
-1229
lines changed

10 files changed

+1890
-1229
lines changed

package-lock.json

Lines changed: 325 additions & 641 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,33 @@ function setValueFromPath<T extends JsonArray | JsonObject>(
122122
}
123123
}
124124

125+
function normalizeValue(value: string, path: string): JsonValue {
126+
const cliOptionType = validCliPaths.get(path);
127+
if (cliOptionType) {
128+
switch (cliOptionType) {
129+
case 'boolean':
130+
if (value.trim() === 'true') {
131+
return true;
132+
} else if (value.trim() === 'false') {
133+
return false;
134+
}
135+
break;
136+
case 'number':
137+
const numberValue = Number(value);
138+
if (!Number.isNaN(numberValue)) {
139+
return numberValue;
140+
}
141+
break;
142+
case 'string':
143+
return value;
144+
}
145+
146+
throw new Error(`Invalid value type; expected a ${cliOptionType}.`);
147+
}
148+
149+
return parseJson(value, JsonParseMode.Loose);
150+
}
151+
125152
export default class ConfigCommand extends Command {
126153
public readonly name = 'config';
127154
public readonly description = 'Get/set configuration values.';
@@ -178,14 +205,7 @@ export default class ConfigCommand extends Command {
178205
// TODO: Modify & save without destroying comments
179206
const configValue = config.value;
180207

181-
const value = parseJson(options.value, JsonParseMode.Loose);
182-
const pathType = validCliPaths.get(options.jsonPath);
183-
if (pathType) {
184-
if (typeof value != pathType) {
185-
throw new Error(`Invalid value type; expected a ${pathType}.`);
186-
}
187-
}
188-
208+
const value = normalizeValue(options.value, options.jsonPath);
189209
const result = setValueFromPath(configValue, options.jsonPath, value);
190210

191211
if (result === undefined) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default class ServeCommand extends ArchitectCommand {
1212
public readonly name = 'serve';
1313
public readonly target = 'serve';
1414
public readonly description = 'Builds and serves your app, rebuilding on file changes.';
15-
public static aliases = ['server', 's'];
15+
public static aliases = ['s'];
1616
public readonly scope = CommandScope.inProject;
1717
public readonly options: Option[] = [
1818
this.prodOption,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default class VersionCommand extends Command {
3131
/^@schematics\/.*/,
3232
/^rxjs$/,
3333
/^typescript$/,
34+
/^ng-packagr$/,
3435
/^webpack$/,
3536
];
3637

0 commit comments

Comments
 (0)