Tihtovot
This project was generated with Angular CLI version 9.0.7.
Development server
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Code scaffolding
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Build
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Running unit tests
Run ng test
to execute the unit tests via Karma.
Running end-to-end tests
Run ng e2e
to execute the end-to-end tests via Protractor.
Further help
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.
To give a brief summary, this is how I proceeded:
Install ng-packagr:
Install it globally:
npm install -g ng-packagr
Install it in the project module:
npm install ng-packagr --save-dev
create ng-package.json in the root folder of the project, and add the following:
{
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
"lib": {
"entryFile": "public_api.ts"
"externals": {
"@angular/cdk": "ng.cdk",
"@angular/cdk/accordion": "ng.cdk.accordion",
//...
}
}
}
Run code snippetExpand snippet
In my case I had to add external dependencies in order to avoid packaging/build errors:
create public_api.ts in the root folder of the project, and add the following:
export * from './src/app/modules/myFeature/my-feature.module'
Edit package.json, and add the packagr line to the scripts tag:
"scripts": { //... "packagr": "ng-packagr -p ng-package.json" } Run code snippetExpand snippet Create the package by running the following command from the root folder:
npm run packagr
Install it for local development:
Pack the module by running the following command from the dist folder: npm pack Install the packed module from the final project: npm install ../some-relative-path/dist/my-component-library-0.0.0.tgz Then I could import my module from any other module or component of my final project
npm login
publish th epackage to NPM:
npm publish --access public
-----5.1.2021---- לשנות מס גרסה ב pacakage.json npm run packagr npm pack בתיקית dist npm publish --access public כאדמין בתיקיית תכתובות להריץ
if run tihtovot local change the router.forRoot() instead for child. remove add instead uncomment BrowserAnimationsModule comment imports: [RouterModule.forChild(routes)], remove for root from main app module