diff --git a/modules/schematics/collection.json b/modules/schematics/collection.json index c1d01de27f..9a87c2e259 100644 --- a/modules/schematics/collection.json +++ b/modules/schematics/collection.json @@ -1,4 +1,5 @@ { + "extends": ["@schematics/angular"], "schematics": { "action": { "aliases": [ "a" ], @@ -7,16 +8,6 @@ "description": "Add store actions" }, - "class": { - "aliases": [ "cl" ], - "extends": "@schematics/angular:class" - }, - - "component": { - "aliases": [ "c" ], - "extends": "@schematics/angular:component" - }, - "container": { "aliases": [ "co" ], "factory": "./src/container", @@ -24,11 +15,6 @@ "description": "Add store container component" }, - "directive": { - "aliases": [ "d" ], - "extends": "@schematics/angular:directive" - }, - "effect": { "aliases": [ "ef" ], "factory": "./src/effect", @@ -43,11 +29,6 @@ "description": "Add entity state" }, - "enum": { - "aliases": [ "e" ], - "extends": "@schematics/angular:enum" - }, - "feature": { "aliases": [ "f" ], "factory": "./src/feature", @@ -55,26 +36,6 @@ "description": "Add feature state" }, - "guard": { - "aliases": [ "g" ], - "extends": "@schematics/angular:guard" - }, - - "interface": { - "aliases": [ "i" ], - "extends": "@schematics/angular:interface" - }, - - "module": { - "aliases": [ "m" ], - "extends": "@schematics/angular:module" - }, - - "pipe": { - "aliases": [ "p" ], - "extends": "@schematics/angular:pipe" - }, - "reducer": { "aliases": [ "r" ], "factory": "./src/reducer", @@ -82,11 +43,6 @@ "description": "Add state reducer" }, - "service": { - "aliases": [ "s" ], - "extends": "@schematics/angular:service" - }, - "store": { "aliases": [ "st" ], "factory": "./src/store", diff --git a/modules/schematics/package.json b/modules/schematics/package.json index 62e08555af..77312bb982 100644 --- a/modules/schematics/package.json +++ b/modules/schematics/package.json @@ -20,5 +20,9 @@ "url": "https://github.com/ngrx/platform/issues" }, "homepage": "https://github.com/ngrx/platform#readme", - "schematics": "./collection.json" + "schematics": "./collection.json", + "peerDependencies": { + "@angular-devkit/core": "^0.4.0", + "@angular-devkit/schematics": "^0.4.0" + } } diff --git a/modules/schematics/src/cli.spec.ts b/modules/schematics/src/cli.spec.ts new file mode 100644 index 0000000000..84a3c7e2c0 --- /dev/null +++ b/modules/schematics/src/cli.spec.ts @@ -0,0 +1,28 @@ +import { Tree, VirtualTree } from '@angular-devkit/schematics'; +import { SchematicTestRunner } from '@angular-devkit/schematics/testing'; +import * as path from 'path'; +import { createAppModule, getFileContent } from './utility/test'; + +describe('CLI Schematic', () => { + const schematicRunner = new SchematicTestRunner( + '@ngrx/schematics', + path.join(__dirname, '../collection.json') + ); + const defaultOptions = { + name: 'foo', + }; + + let appTree: Tree; + + beforeEach(() => { + appTree = new VirtualTree(); + appTree = createAppModule(appTree); + }); + + it('should create a class by the angular/cli', () => { + const options = { ...defaultOptions, state: undefined }; + const tree = schematicRunner.runSchematic('class', options, appTree); + const content = getFileContent(tree, '/src/app/foo.ts'); + expect(content).toMatch(/export class Foo/); + }); +});