Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 519eb6c

Browse files
kgajeraalan-agius4
authored andcommittedJul 7, 2020
fix(@schematics/angular): validate project name before prompts
When an invalid project name is given, throw an error before going through prompts. Closes #14994 (cherry picked from commit a8c63a7)
1 parent 07f93b7 commit 519eb6c

File tree

1 file changed

+3
-0
lines changed
  • packages/schematics/angular/ng-new

1 file changed

+3
-0
lines changed
 

‎packages/schematics/angular/ng-new/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
RepositoryInitializerTask,
2525
} from '@angular-devkit/schematics/tasks';
2626
import { Schema as ApplicationOptions } from '../application/schema';
27+
import { validateProjectName } from '../utility/validation';
2728
import { Schema as WorkspaceOptions } from '../workspace/schema';
2829
import { Schema as NgNewOptions } from './schema';
2930

@@ -33,6 +34,8 @@ export default function(options: NgNewOptions): Rule {
3334
throw new SchematicsException(`Invalid options, "name" is required.`);
3435
}
3536

37+
validateProjectName(options.name);
38+
3639
if (!options.directory) {
3740
options.directory = options.name;
3841
}

0 commit comments

Comments
 (0)
Please sign in to comment.