How to generate project
Install/upgrade angular-cli
npm uninstall -g angular-cli
npm cache clean or npm cache verify (if npm > 5)
npm install -g @angular/cli@latest
Init an angular project using angular-cli
ng new ng-organization
- no routing
Generate angular library
cd ng-organization
ng generate library ng-department
Build the library
ng build ng-department
Generate config
ng generate class model/DepartmentConfig --project=ng-department
Publish to npmjs.com
ng build ng-department
npm login
- razvansimion
- Passw0rd0139!
- simionrazvan@gmail.com
cd .\dist\ng-department\
npm publish
NgDepartment
This library was generated with Angular CLI version 8.0.1.
Code scaffolding
Run ng generate component component-name --project ng-department
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project ng-department
.
Note: Don't forget to add
--project ng-department
or else it will be added to the default project in yourangular.json
file.
Build
Run ng build ng-department
to build the project. The build artifacts will be stored in the dist/
directory.
Publishing
After building your library with ng build ng-department
, go to the dist folder cd dist/ng-department
and run npm publish
.
Running unit tests
Run ng test ng-department
to execute the unit tests via Karma.
Further help
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.