This repository is used to generate modules, containers, components, and entities for Angular projects.
- Run
npm install @tech4good/angular-schematics
. - Set the schematics to be the default using:
ng config cli.defaultCollection @tech4good/angular-schematics
- Change directories to the directory you want to generate the files and run
ng generate <schematic> <name>
, whereschematic
= module, container, component, or entity (or if you did not make it the default, useng generate @tech4good/angular-schematics:<schematic> <name>
)
- Clone this repository.
- Run
npm install -g @angular-devkit/schematics-cli
to install globally - Run
npm install
,npm run build
&npm link
- Run
npm link @tech4good/angular-schematics
in the Angular project directory - Run
ng generate @tech4good/angular-schematics:<schematic>
to generate files (schematic
= module, container, component, or entity) - To test/debug new changes, run
npm run build
again beforeng generate ...
To test, install the repo directly from github into another local repo to test your schematic.
npm install https://github.com/tech4good-lab/angular-schematics.git#your-branch-name
npm link @tech4good/angular-schematics
ng generate @tech4good/angular-schematics:<schematic>
npm run test
will run the unit tests, using Jasmine as a runner and test framework.
To publish, simply do:
npm run build
npm publish # will ask for a OTP (see Google Authenticator: npm)
That's it!
You can also use npm version <version>
to update the version before publishing.
- Don't forget to also update
src/init/files/package.json.template
so that the latest version of@tech4good/anguar-schematics
is being used in the dependencies. - If we are making a major update for a new angular version, we also need to update the version number in
package.json.template
.