step-one-schematics v0.0.1
Getting Started With Schematics
This repository is a basic Schematic implementation that serves as a starting point to create and publish Schematics to NPM.
Testing
To test locally, install @angular-devkit/schematics-cli
globally and use the schematics
command line tool. That tool acts the same as the generate
command of the Angular CLI, but also has a debug mode.
Check the documentation with
schematics --help
Unit Testing
npm run test
will run the unit tests, using Jasmine as a runner and test framework.
Publishing
To publish, simply do:
npm run build
npm publish
That's it!
npm install @angular/cli npm install create a schema.json on root(step_one).json file on collection.json we need to add a "schema":./step-one/schema.json // under step-one
npm run build npm run test if required ... const tree = await runner.runSchematicAsync('step-one', {"name":"test"}, Tree.empty()).toPromise(); schematics .:step-one --name=test watch mode: npm run build -- -w
create a directory called template-files add some files to the directory
add "path" property to schema on index.ts add the:apply,url,mergeWith,MergeStrategy,move import {normalize} from '@angular-devkit/core' ===========================================================
schematics .:step-one --name=test --path=aaaaa --dry-run false
npm run build npm link on the other project we should npm link step-one then ng g step-one:step-one --name=poc-test
npm install (name on p.json):step-one-schematics
4 years ago