diff --git a/projects/ngx-spinner/package.json b/projects/ngx-spinner/package.json index c00525e..3db22ec 100644 --- a/projects/ngx-spinner/package.json +++ b/projects/ngx-spinner/package.json @@ -1,6 +1,7 @@ { "name": "ngx-spinner", "version": "8.1.0", + "schematics": "./schematics/collection.json", "repository": { "type": "git", "url": "https://github.com/Napster2210/ngx-spinner.git" @@ -45,4 +46,4 @@ "@angular/common": "^8.0.0", "@angular/core": "^8.0.0" } -} +} \ No newline at end of file diff --git a/projects/ngx-spinner/schematics/collection.json b/projects/ngx-spinner/schematics/collection.json new file mode 100644 index 0000000..6ef4505 --- /dev/null +++ b/projects/ngx-spinner/schematics/collection.json @@ -0,0 +1,9 @@ +{ + "$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json", + "schematics": { + "ng-add": { + "description": "Add ngx-spinner to the project.", + "factory": "./ng-add/index#ngAdd" + } + } +} \ No newline at end of file diff --git a/projects/ngx-spinner/schematics/ng-add/index.ts b/projects/ngx-spinner/schematics/ng-add/index.ts new file mode 100644 index 0000000..f749c7a --- /dev/null +++ b/projects/ngx-spinner/schematics/ng-add/index.ts @@ -0,0 +1,10 @@ +import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics'; +import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks'; + +// Just return the tree +export function ngAdd(_options: any): Rule { + return (tree: Tree, _context: SchematicContext) => { + _context.addTask(new NodePackageInstallTask()); + return tree; + }; +}