id-collection v0.0.3
IdCollection
This project was generated with Angular CLI version 6.0.8.
Note: Angular 6 must be installed on your local machine in order to build a library! To do so run the following commands in your Node Command line:
npm uninstall -g @angular/cli
npm cache verify
npm install -g @angular/cli
Exposing the Component Api
The file public_api.ts in the folder projects/id-collection-component/src/public_api.ts
is where we declare our Public Api surface - everything that's exposed outside of our component.
If we set the @Injectable({ providedIn: root })
for the likes of services, allows you to provide a service without explicitly registering it in any NgModule (useful for tree shaking if the service is never used).
Build Component
We can build a specific project within the solution with the following command:
ng build id-collection-component
Unit Test Component
Instead of running the usual command for unit testing:
ng test
We can now test our projects individually as follows:
ng test id-collection-component
Publish Component
To make the library available on npm (or myGet) all you need to do is create a production build, and run npm publish
command from the project’s dist directory:
ng build id-collection-component --prod
cd dist/id-collection-component
npm publish
This can be used for testing (npm) but the Release pipeline will take care of pushing to myGet for us.