Contezza's reusable components and services library
This project is a collection of Angular components and services to be re-used internally across various applications of Contezza BV.
Project
The whole project is architected as a test project fro the components/services in development. The components/services are imported in the project internally for test use.
Modules
Each component/service has it's own module with separate package.json && ng-package.json files. This way each component/service is completely independent in use and development. Each module can be published to npm as a separate component/service or a collection of such. Modules are located in the root folder /modules
.
Build
Run npm run build:modules
in the root of the project to build the modules. Eventually adjust the script to exclude/include modules in the build. The build artifacts will be stored in the dist/
directory of the module.
Npm publish
Run npm publish
from the /dist
directory of the module. You have to have got an npm account and be white-listed as a collaborator of the module.
Use components/services in the project
Modules can be imported in the usual way in the app.module.ts
file. For example like so:
import { CntzModule } from '@akolybelnikov/cntz-service';
Components and services can then be used in a component: import { CntzService } from '@akolybelnikov/cntz-service';
Further help
To get more information and how-to's you can refer to the following sources:
https://www.tsmean.com/articles/how-to-write-a-typescript-library/angular/
https://github.com/filipesilva/angular-quickstart-lib
https://medium.com/@cyrilletuzi/how-to-build-and-publish-an-angular-module-7ad19c0b4464