将Angular库用作git依赖项 [英] Consume Angular library as git dependency

查看:88
本文介绍了将Angular库用作git依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Angular库托管在git存储库中,但未发布到npm.该库与ng-packagr打包在一起.是否可以将其作为git依赖项导入到另一个项目中?

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?

仅将git URL指定为npm依赖项是行不通的,因为ng-packagr将Angular库构建到dist文件夹中,并且该文件夹通常发布到npm.您可以指定一个postinstall脚本,但是之后如何配置该库的根文件夹实际上位于dist文件夹中?

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?

我不想发布到npm,因为该应用程序不是开源的.我可以使用私有的npm存储库,但是我在考虑是否可以避免所有麻烦.

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.

推荐答案

我所做的实际上是将其指定为git依赖项,添加了安装后脚本,并且在导入时正在导入library/dist.

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

这篇关于将Angular库用作git依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆