Skip to content

Commit e662247

Browse files
Ayudhclydin
authored andcommitted
fix(@schematics/schematics): run install step with sample schematics
Closes #17425 (cherry picked from commit 6c0ab83)
1 parent 2c2bd52 commit e662247

File tree

1 file changed

+20
-13
lines changed
  • packages/schematics/schematics/schematic

1 file changed

+20
-13
lines changed

packages/schematics/schematics/schematic/factory.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,38 @@
88
import { Path, strings } from '@angular-devkit/core';
99
import {
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';
1821
import { Schema } from './schema';
1922

2023

2124
export 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) => !/\/src\/.*?\/files\//.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) => !/\/src\/.*?\/files\//.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
}

0 commit comments

Comments
 (0)