@dcs/schematics
v1.2.3
Published
Angular schematics used at DCS
Downloads
3
Readme
Getting Started With Schematics
This repository is a basic Schematic implementation that serves as a starting point to create and publish Schematics to NPM.
prerequisites
install the schematics cli
- npm install -g @angular-devkit/schematics-cli
set up dcs schematics
- git clone [email protected]:dcsfuerth/dcs-schematics.git
- cd dcs-schematics
- npm install
- npm run build
- Test it with: schematics .:read-reducer --name=helloworld (dry-run is default, so no files should be created)
schematics .:read-reducer --name=helloworld
CREATE /src/app/reducers/helloworld/helloworld.actions.ts (278 bytes)
CREATE /src/app/reducers/helloworld/helloworld.manager.ts (974 bytes)
CREATE /src/app/reducers/helloworld/models/helloworld.class.ts (387 bytes)
set up foodstore as test environment
- git clone [email protected]:dcsfuerth/ngx-food-order-cli.git
- cd ngx-food-order-cli
- npm install
- npm link /Users/entwickler/Documents/Projekte/howtoschematics/dcs-schematics
adding a new feature
- open dcs-schematics project
- schematics blank --name=read-reducer-simple
- implement functionality
- npm run build
- schematics .:read-reducer-simple --name=helloworld
- open dcs-foodstore project
- ng g @dcs/schematics:read-reducer-simple --name VisitorsNr
Testing
To test locally, install @angular-devkit/schematics
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!