Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Consume Angular library as git dependency

Tags:

npm

angular

I have an Angular library hosted in a git repository but not published to npm. The library is packaged with ng-packagr. Is it possible to import it as a git dependency in another project?

Simply specifying the git URL as a npm dependency does not work, because ng-packagr builds the Angular library into the dist folder and that folder is usually published to npm. You can specify a postinstall script, but how can you configure afterwards that the root folder of the library is actually in the dist folder?

I don't want to publish to npm because the application is not open source. I could use a private npm repository, but I was thinking if I can avoid all the hassle.

like image 459
Adrian Ber Avatar asked Jan 04 '18 14:01

Adrian Ber


1 Answers

What I did was actually to specify this as a git dependency, add a postinstall script and when importing I was importing library/dist.

like image 97
Adrian Ber Avatar answered Oct 12 '22 02:10

Adrian Ber