Skip to content

Commit 8683c3c

Browse files
RicardoVarandaBrocco
authored andcommitted
fix(@angular/cli): fix leading digit in file names from generate command
1 parent 2b0d935 commit 8683c3c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

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

+5
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ export default Command.extend({
7878
`The \`ng generate ${name}\` command requires a name to be specified.`);
7979
}
8080

81+
if (/^\d/.test(rawArgs[1])) {
82+
SilentError.debugOrThrow('@angular/cli/commands/generate',
83+
`The \`ng generate ${name} ${rawArgs[1]}\` file name cannot begin with a digit.`);
84+
}
85+
8186
rawArgs[0] = blueprint.name;
8287
this.registerOptions(blueprint);
8388
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import {ng} from '../../utils/process';
2+
import {expectToFail} from '../../utils/utils';
3+
4+
5+
export default function() {
6+
return Promise.resolve()
7+
.then(() => expectToFail(() =>
8+
ng('generate', 'component', '1my-component')));
9+
}

0 commit comments

Comments
 (0)