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 88import { Path , strings } from '@angular-devkit/core' ;
99import {
1010 Rule ,
11+ SchematicContext ,
12+ Tree ,
1113 apply ,
1214 mergeWith ,
1315 move ,
1416 partitionApplyMerge ,
1517 template ,
1618 url ,
1719} from '@angular-devkit/schematics' ;
20+ import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks' ;
1821import { Schema } from './schema' ;
1922
2023
2124export default function ( options : Schema ) : Rule {
2225 const schematicsVersion = require ( '@angular-devkit/schematics/package.json' ) . version ;
2326 const coreVersion = require ( '@angular-devkit/core/package.json' ) . version ;
2427
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+ } ;
3845}
You can’t perform that action at this time.
0 commit comments