How to define a Bower dependency to a Git repository with no releases tagged?

别说谁变了你拦得住时间么 提交于 2019-12-04 07:55:49

问题


Trying to add a dependency to arbor using Bower. This JS library does not have any releases tagged in GitHub, but has been published to Bower. How should the dependency look in bower.json?

"dependencies": {
   "arbor": ...
}

回答1:


As it is written in the documentation, you can specify the package in form of a remote Git endpoint:

"dependencies": {
    "some-package": "git://github.com/someone/some-package.git"
 }

Since GitHub is usually used, there is a shortcut for this (unless specified otherwise):

"dependencies": {
    "some-package": "someone/some-package"
 }

This will download the newest version of the package. To make sure that your app will work with the downloaded version, you can specify the commit with its hash. So this

"dependencies": {
    "some-package": "someone/some-package#ddb859e7e7d2beb9c7ecd54cfe4ea2e67ac1d797"
 }

will always download the package in the state of that specific commit.

Update: Changed protocol from SSH (git@github.com:) to plain git (git://github.com/) as pointed out in the comments.



来源:https://stackoverflow.com/questions/20311804/how-to-define-a-bower-dependency-to-a-git-repository-with-no-releases-tagged

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!