mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 18:13:38 +08:00
fix(@angular/cli): fix support for default values in options
This commit is contained in:
parent
b5fc50fa1c
commit
d10c9e3104
@ -151,26 +151,23 @@ export async function parseJsonSchemaToOptions(
|
||||
}
|
||||
|
||||
let defaultValue: string | number | boolean | undefined = undefined;
|
||||
if (schema.default !== undefined) {
|
||||
if (current.default !== undefined) {
|
||||
switch (types[0]) {
|
||||
case 'string':
|
||||
if (typeof schema.default == 'string') {
|
||||
defaultValue = schema.default;
|
||||
if (typeof current.default == 'string') {
|
||||
defaultValue = current.default;
|
||||
}
|
||||
break;
|
||||
case 'number':
|
||||
if (typeof schema.default == 'number') {
|
||||
defaultValue = schema.default;
|
||||
if (typeof current.default == 'number') {
|
||||
defaultValue = current.default;
|
||||
}
|
||||
break;
|
||||
case 'boolean':
|
||||
if (typeof schema.default == 'boolean') {
|
||||
defaultValue = schema.default;
|
||||
if (typeof current.default == 'boolean') {
|
||||
defaultValue = current.default;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log(types[0], schema);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ export default function() {
|
||||
.then(() => ng('generate', 'fake', '--help'))
|
||||
// verify same output
|
||||
.then(({stdout}) => {
|
||||
if (!/ng generate fake-schematics:fake <a> <b> \[options\]/.test(stdout)) {
|
||||
if (!/ng generate fake <a> <b> \[options\]/.test(stdout)) {
|
||||
throw new Error('Help signature is wrong (2).');
|
||||
}
|
||||
if (!/opt-a[\s\S]*opt-b[\s\S]*opt-c/.test(stdout)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user