File tree Expand file tree Collapse file tree 1 file changed +20
-13
lines changed
packages/schematics/schematics/schematic Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Original file line number Diff line number Diff line change 8
8
import { Path , strings } from '@angular-devkit/core' ;
9
9
import {
10
10
Rule ,
11
+ SchematicContext ,
12
+ Tree ,
11
13
apply ,
12
14
mergeWith ,
13
15
move ,
14
16
partitionApplyMerge ,
15
17
template ,
16
18
url ,
17
19
} from '@angular-devkit/schematics' ;
20
+ import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks' ;
18
21
import { Schema } from './schema' ;
19
22
20
23
21
24
export default function ( options : Schema ) : Rule {
22
25
const schematicsVersion = require ( '@angular-devkit/schematics/package.json' ) . version ;
23
26
const coreVersion = require ( '@angular-devkit/core/package.json' ) . version ;
24
27
25
- return mergeWith ( apply ( url ( './files' ) , [
26
- partitionApplyMerge (
27
- ( p : Path ) => ! / \/ s r c \/ .* ?\/ f i l e s \/ / . test ( p ) ,
28
- template ( {
29
- ...options as object ,
30
- coreVersion,
31
- schematicsVersion,
32
- dot : '.' ,
33
- dasherize : strings . dasherize ,
34
- } ) ,
35
- ) ,
36
- move ( options . name ) ,
37
- ] ) ) ;
28
+ return ( _tree : Tree , context : SchematicContext ) => {
29
+ context . addTask ( new NodePackageInstallTask ( options . name ) ) ;
30
+
31
+ return mergeWith ( apply ( url ( './files' ) , [
32
+ partitionApplyMerge (
33
+ ( p : Path ) => ! / \/ s r c \/ .* ?\/ f i l e s \/ / . test ( p ) ,
34
+ template ( {
35
+ ...options as object ,
36
+ coreVersion,
37
+ schematicsVersion,
38
+ dot : '.' ,
39
+ dasherize : strings . dasherize ,
40
+ } ) ,
41
+ ) ,
42
+ move ( options . name ) ,
43
+ ] ) ) ;
44
+ } ;
38
45
}
You can’t perform that action at this time.
0 commit comments