Skip to content

Commit 04ac6e2

Browse files
committed
feat(schematics): Add basic ng-add and ng-update
1 parent 8e83f84 commit 04ac6e2

File tree

7 files changed

+79
-0
lines changed

7 files changed

+79
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"start": "ng serve",
77
"build": "ng build ngx-ui-loader && ng build",
88
"build:lib": "ng build ngx-ui-loader && cp README.md CHANGELOG.md LICENSE ./dist/ngx-ui-loader/",
9+
"build:schematics": "cd projects/ngx-ui-loader && npm run build && cd ../..",
910
"test": "ng test ngx-ui-loader --code-coverage",
1011
"lint": "ng lint",
1112
"e2e": "ng e2e"

projects/ngx-ui-loader/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
"name": "ngx-ui-loader",
33
"description": "An all-in-one and fully customizable loader/spinner for Angular 5, 6 and 7+ applications. It supports foreground, background spinner/loader, indicative progress bar and multiple loaders.",
44
"version": "7.2.2",
5+
"scripts": {
6+
"build": "../../node_modules/.bin/tsc -p tsconfig.schematics.json",
7+
"copy:collections": "cp schematics/*collection.json ../../dist/ngx-ui-loader/schematics/",
8+
"postbuild": "npm run copy:collections"
9+
},
10+
"schematics": "./schematics/collection.json",
11+
"ng-update": {
12+
"migrations": "./schematics/migration-collection.json"
13+
},
514
"repository": {
615
"type": "git",
716
"url": "https://github.com/t-ho/ngx-ui-loader.git"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
3+
"schematics": {
4+
"ng-add": {
5+
"description": "Add ngx-ui-loader to the project.",
6+
"factory": "./ng-add/index#ngAdd"
7+
}
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"schematics": {
3+
"migration-01": {
4+
"version": "7.2.2",
5+
"factory": "./update/index#update722",
6+
"description": "Update ngx-ui-loader to version 7.2.2"
7+
}
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
2+
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
3+
4+
export function ngAdd(_options: any): Rule {
5+
return (tree: Tree, _context: SchematicContext) => {
6+
_context.addTask(new NodePackageInstallTask());
7+
return tree;
8+
}
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
2+
3+
export function update722(_options: any): Rule {
4+
return (tree: Tree, _context: SchematicContext) => {
5+
return tree;
6+
}
7+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"lib": [
5+
"es2018",
6+
"dom"
7+
],
8+
"declaration": true,
9+
"module": "commonjs",
10+
"moduleResolution": "node",
11+
"noEmitOnError": true,
12+
"noFallthroughCasesInSwitch": true,
13+
"noImplicitAny": true,
14+
"noImplicitThis": true,
15+
"noUnusedParameters": true,
16+
"noUnusedLocals": true,
17+
"rootDir": "schematics",
18+
"outDir": "../../dist/ngx-ui-loader/schematics",
19+
"skipDefaultLibCheck": true,
20+
"skipLibCheck": true,
21+
"sourceMap": true,
22+
"strictNullChecks": true,
23+
"target": "es6",
24+
"types": [
25+
"jasmine",
26+
"node"
27+
]
28+
},
29+
"include": [
30+
"schematics/**/*"
31+
],
32+
"exclude": [
33+
"schematics/*/files/**/*"
34+
]
35+
}

0 commit comments

Comments
 (0)