Skip to content

Commit 78e33e5

Browse files
authored
fix: add skipInstall option to ng-new (#223)
1 parent 8a6de14 commit 78e33e5

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/ng-new/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
chain,
55
schematic,
66
SchematicContext,
7+
TaskId,
78
} from '@angular-devkit/schematics';
89

910
import { Schema as ApplicationOptions } from './application/schema';
@@ -28,9 +29,13 @@ export default function(options: NgNewOptions): Rule {
2829
}
2930
},
3031
(_tree: Tree, context: SchematicContext) => {
31-
const packageTask = context.addTask(new NodePackageInstallTask(options.name));
32+
const dependencies: Array<TaskId> = [];
33+
34+
if (!options.skipInstall) {
35+
const packageInstallTask = context.addTask(new NodePackageInstallTask(options.name));
36+
dependencies.push(packageInstallTask);
37+
}
3238

33-
const dependencies = [packageTask];
3439
context.addTask(new RepositoryInitializerTask(options.name, {}), dependencies);
3540
},
3641
]);
@@ -51,7 +56,6 @@ const parseToSharedOptions = (options: NgNewOptions): SharedOptions => {
5156
const parseToApplicationOptions = (options: NgNewOptions): ApplicationOptions => {
5257
return {
5358
name: options.name,
54-
5559
prefix: options.prefix,
5660
sourceDir: options.sourceDir || 'app',
5761
style: options.style,

src/ng-new/schema.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,8 @@ export interface Schema {
3535
* Skip adding an example component.
3636
*/
3737
skipAutoGeneratedComponent?: boolean;
38+
/**
39+
* When true, does not install packages for dependencies.
40+
*/
41+
skipInstall?: boolean;
3842
}

src/ng-new/schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@
5252
"type": "boolean",
5353
"description": "Specifies whether a sample master detail should be generated.",
5454
"default": false
55+
},
56+
"skipInstall": {
57+
"description": "When true, does not install packages for dependencies.",
58+
"type": "boolean",
59+
"default": false
5560
}
5661
},
5762
"required": [

0 commit comments

Comments
 (0)