Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I publish an Angular-CLI project as an NPM module?

I'm making my own Angular 2 module with Angular-CLI. How to prepare module to import? How do I publish the final output to NPM for use with other Angular2 projects?

like image 609
piernik Avatar asked Oct 31 '16 13:10

piernik


1 Answers

I've managed to publish my project to npm. Here's what I did.

In angular-cli project my module went to single folder (component-warpper). In that folder I've added index.ts with list of modules and components to export. I also added package.json file (screenshot).

Then in command line go to this folder and npm publish. Now I can import it as node_modules in other projects.

enter image description here

like image 136
piernik Avatar answered Oct 05 '22 12:10

piernik