fix(@angular/cli): fix leading digit in file names from generate command

This commit is contained in:
Ricardo Varanda 2017-05-18 15:55:32 +01:00 committed by Mike Brocchi
parent 2b2e8b3685
commit dbfa851709
2 changed files with 14 additions and 0 deletions

View File

@ -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);
}, },

View 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')));
}