Skip to content

Commit 0ecaa2d

Browse files
RicardoVarandaBrocco
authored andcommitted
fix(@angular/cli): fix leading digit in file names from generate command
1 parent 41d8522 commit 0ecaa2d

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
@@ -72,6 +72,11 @@ export default Command.extend({
7272
`The \`ng generate ${name}\` command requires a name to be specified.`);
7373
}
7474

75+
if (/^\d/.test(rawArgs[1])) {
76+
SilentError.debugOrThrow('@angular/cli/commands/generate',
77+
`The \`ng generate ${name} ${rawArgs[1]}\` file name cannot begin with a digit.`);
78+
}
79+
7580
rawArgs[0] = blueprint.name;
7681
this.registerOptions(blueprint);
7782
},
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)