Skip to content

Commit

Permalink
feat(ng-add): generate
Browse files Browse the repository at this point in the history
`schematics blank --name=ng-add`
  • Loading branch information
kaltepeter committed Oct 15, 2020
1 parent 129cba1 commit bb5a94e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"svg-icons-builder": {
"description": "A blank schematic.",
"factory": "./svg-icons-builder/index#svgIconsBuilder"
},
"ng-add": {
"description": "A blank schematic.",
"factory": "./ng-add/index#ngAdd"
}
}
}
10 changes: 10 additions & 0 deletions src/ng-add/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';


// You don't have to export the function as default. You can also have more than one rule factory
// per file.
export function ngAdd(_options: any): Rule {
return (tree: Tree, _context: SchematicContext) => {
return tree;
};
}
16 changes: 16 additions & 0 deletions src/ng-add/index_spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Tree } from '@angular-devkit/schematics';
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
import * as path from 'path';


const collectionPath = path.join(__dirname, '../collection.json');


describe('ng-add', () => {
it('works', async () => {
const runner = new SchematicTestRunner('schematics', collectionPath);
const tree = await runner.runSchematicAsync('ng-add', {}, Tree.empty()).toPromise();

expect(tree.files).toEqual([]);
});
});

0 comments on commit bb5a94e

Please sign in to comment.