定制凉亭包

时间:2017-05-15 16:57:50

标签: javascript git github bower

我在我的项目中使用了几个开源的js库。我最近开始使用bower来处理所有前端依赖项。我喜欢我怎么能提供一个github网址而不是一个正确的包名。

我定制了几个库。因此,为了使用bower管理它们,我在Github上的组织帐户中创建了一个名为myLibs的私有存储库。

我正在为每个自定义库创建分支。例如,自定义angular-bootstrap库将位于angular-bootstrap分支中,自定义angular-material库将位于angular-material分支中。

现在我正在为每个库中的每个版本创建标签。我使用的命名约定是branch-name/x.y.z例如,我有angular-bootstrap/1.0.0angular-material/1.1.1标记。

这很好,直到我不得不使用bower安装这些库。要安装自定义库,我调用了以下命令(它是一个虚拟URL,不要尝试)

bower install --save-exact library-patch=https://github.com/test_org/myLibs.git#branch-name/1.0.0

库已安装,我也可以在bower_components中看到它,但是在我的bower.json中,依赖项输入就像这样 -

"library-patch":"https://github.com/test_org/myLibs.git#undefined"

这不是我想要的。我想要保存正确的标签名称。每次我想添加自定义库时,我都不想在bower.json文件中手动进行更改。

我的第一个想法是标签的命名约定将是一个问题。所以我在依赖项末尾从branch-name-x.y.z #undefined`标签将其更改为branch-name/x.y.z which allowed me to have the exact version in the bower.json to install it properly, but when trying to install the libraries using the terminal, instead of using bower.json, I am getting the

这是从终端安装库时我得到的日志。

bower install --save-exact library-patch=https://github.com/test_org/myLibs.git#branch-name-1.0.0
bower not-cached    https://github.com/test_org/myLibs.git#branch-name-1.0.0
bower resolve       https://github.com/test_org/myLibs.git#branch-name-1.0.0
bower download      https://github.com/test_org/myLibs/archive/branch-name-1.0.0.tar.gz
bower retry         Download of https://github.com/test_org/myLibs/archive/branch-name-1.0.0.tar.gz failed with EHTTP, trying with git..
bower checkout      library-patch#branch-name-1.0.0
bower resolved      https://github.com/test_org/myLibs.git#branch-name-1.0.0
bower install       library-patch#branch-name-1.0.0

library-patch#branch-name-1.0.0 bower_components/library-patch
└── angular#1.4.8

为什么我在发布/标记名称中未定义?在命名标签时我是否犯了错误?有什么办法可以从终端安装那些自定义库并在bower.json中保存确切的标签吗?

1 个答案:

答案 0 :(得分:0)

问题的解决方案是使用--save而不是--save-exact。我现在没有相同的解释,但我会尽快更新答案。

据我所知,这是因为软件包直接从github安装,而不是从bower注册表安装。