mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-18 20:02:40 +08:00
fix(@angular/cli): fix leading digit in file names from generate command
This commit is contained in:
parent
2b2e8b3685
commit
dbfa851709
@ -78,6 +78,11 @@ export default Command.extend({
|
|||||||
`The \`ng generate ${name}\` command requires a name to be specified.`);
|
`The \`ng generate ${name}\` command requires a name to be specified.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (/^\d/.test(rawArgs[1])) {
|
||||||
|
SilentError.debugOrThrow('@angular/cli/commands/generate',
|
||||||
|
`The \`ng generate ${name} ${rawArgs[1]}\` file name cannot begin with a digit.`);
|
||||||
|
}
|
||||||
|
|
||||||
rawArgs[0] = blueprint.name;
|
rawArgs[0] = blueprint.name;
|
||||||
this.registerOptions(blueprint);
|
this.registerOptions(blueprint);
|
||||||
},
|
},
|
||||||
|
9
tests/e2e/tests/generate/generate-name-error.ts
Normal file
9
tests/e2e/tests/generate/generate-name-error.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import {ng} from '../../utils/process';
|
||||||
|
import {expectToFail} from '../../utils/utils';
|
||||||
|
|
||||||
|
|
||||||
|
export default function() {
|
||||||
|
return Promise.resolve()
|
||||||
|
.then(() => expectToFail(() =>
|
||||||
|
ng('generate', 'component', '1my-component')));
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user