Skip to content

Commit 3a15037

Browse files
committed
update schematics version and fix TODOs
1 parent 60a6d4e commit 3a15037

File tree

4 files changed

+40
-34
lines changed

4 files changed

+40
-34
lines changed

package-lock.json

Lines changed: 13 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
"zone.js": "^0.8.4"
4141
},
4242
"devDependencies": {
43-
"@angular-devkit/core": "^0.5.4",
44-
"@angular-devkit/schematics": "file:../devkit/dist/@angular-devkit/schematics/angular-devkit-schematics-0.5.4.tgz",
43+
"@angular-devkit/core": "^0.5.5",
44+
"@angular-devkit/schematics": "^0.5.5",
4545
"@angular/bazel": "6.0.0-rc.1",
4646
"@angular/compiler-cli": "6.0.0-rc.1",
4747
"@angular/http": "6.0.0-rc.1",
@@ -51,7 +51,7 @@
5151
"@angular/upgrade": "6.0.0-rc.1",
5252
"@bazel/ibazel": "0.3.1",
5353
"@google-cloud/storage": "^1.1.1",
54-
"@schematics/angular": "^0.5.4",
54+
"@schematics/angular": "^0.5.5",
5555
"@types/chalk": "^0.4.31",
5656
"@types/fs-extra": "^4.0.3",
5757
"@types/glob": "^5.0.33",

src/lib/schematics/collection.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,23 @@
99
"schema": "./shell/schema.json",
1010
"aliases": ["material-shell"]
1111
},
12+
13+
// Group of schematics used to update Angular CDK and Angular Material.
1214
"ng-update": {
1315
"description": "Updates API usage for the most recent major version of Angular CDK and Angular Material",
1416
"factory": "./update/update"
1517
},
1618
"ng-post-update": {
17-
"description": "Updates API usage for the most recent major version of Angular CDK and Angular Material",
19+
"description": "Performs cleanup after ng-update.",
1820
"factory": "./update/update#postUpdate",
19-
// TODO(mmalerba): put back.
20-
// "private": true
21+
"private": true
22+
},
23+
"ng-post-post-update": {
24+
"description": "Logs completion message for ng-update after ng-post-update.",
25+
"factory": "./update/update#postPostUpdate",
26+
"private": true
2127
},
28+
2229
// Create a dashboard component
2330
"materialDashboard": {
2431
"description": "Create a card-based dashboard component",

src/lib/schematics/update/update.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {FileEntry, Rule, SchematicContext, Tree} from '@angular-devkit/schematics';
1+
import {chain, FileEntry, Rule, SchematicContext, Tree} from '@angular-devkit/schematics';
22
import {
33
NodePackageInstallTask,
44
RunSchematicTask,
@@ -64,13 +64,13 @@ export default function(): Rule {
6464

6565
// Upgrade @angular/material back to 6.x.
6666
const upgradeTask = context.addTask(new NodePackageInstallTask({
67-
// TODO(mmalerba): Change "next" to ">=6 <7". Change material back to npm package.
68-
packageName: '@angular/cdk@next /usr/local/google/home/mmalerba/material2/dist/releases/material/angular-material-6.0.0-rc.1.tgz'
67+
// TODO(mmalerba): Change "next" to ">=6 <7".
68+
packageName: '@angular/cdk@next @angular/material@next'
6969
}), [updateTask]);
7070

7171
// Delete the temporary schematics directory.
7272
context.addTask(
73-
new RunSchematicTask(path.join(__dirname, '../collection.json'), 'ng-post-update', {
73+
new RunSchematicTask('ng-post-update', {
7474
deleteFiles: updateSrcs
7575
.map(entry => entry.path.replace(schematicsSrcPath, schematicsTmpPath))
7676
}), [upgradeTask]);
@@ -79,12 +79,18 @@ export default function(): Rule {
7979

8080
/** Post-update schematic to be called when ng update is finished. */
8181
export function postUpdate(options: {deleteFiles: string[]}): Rule {
82-
return (tree: Tree) => {
82+
return (tree: Tree, context: SchematicContext) => {
8383
for (let file of options.deleteFiles) {
8484
tree.delete(file);
8585
}
8686

87-
console.log('\nComplete! Please check the output above for any issues that were detected but' +
88-
' could not be automatically fixed.');
89-
}
87+
context.addTask(new RunSchematicTask('ng-post-post-update', {}));
88+
};
89+
}
90+
91+
/** Post-post-update schematic to be called when post-update is finished. */
92+
export function postPostUpdate(): Rule {
93+
return () => console.log(
94+
'\nComplete! Please check the output above for any issues that were detected but could not' +
95+
' be automatically fixed.');
9096
}

0 commit comments

Comments
 (0)