How to install latest (untagged) state of a repo using bower?

有些话、适合烂在心里 提交于 2019-11-29 13:06:53

Specify a git commit SHA instead of a version:

bower install '<git-url>#<git-commit-sha>'

Example:

bower install 'git://github.com/yeoman/stringify-object.git#d2895fb97d'

You can also specify a branch instead of a SHA, but that's generally not recommended unless it's in development and you control all the parts.

Nick Tomlin

Yes, you can point to the git url, or use name/repo shorthand (for github repos):

bower.json

{
  "name": "bower-test",
  "dependencies": {
    "dpm": "git@github.com:okfn/dpm.git",
    "docker-nmpjs": "terinjokes/docker-npmjs"
  }
}

More in the docs

As @roi noted in the comments, you can use the --save flag to automatically add dependencies to bower.json, e.g. bower install terinjokes/docker-npmjs --save

You can install a branch in Bower > 1.0.0:

bower install xxx#foo-branch

More details at https://github.com/bower/bower/issues/107#issuecomment-22352689.

If you are using a bower.json file you specify the latest version of a branch with a line in either the dependencies or devDependencies as appropriate for your project configuration:

"angular-bootstrap": "git@github.com:angular-ui/bootstrap.git#bootstrap3",

Then when you run bower install the latest version of that branch is installed. That would be branch bootstrap3 of angular-ui in this example.

bower install --save package-name#master

adds this:

"dependencies": {
  "package-name": "master"
}

using bower.json:

"dependencies": {
    "jquery.slimscroll": "latest",
    "jQuery": "1.11",
    "fullPage.js": "git@github.com:overbyte/fullPage.js.git#1d6bbac3d4c3b1d3d7d4096cdbcabd1c3914393f",
}

where

"[library name - in this case a forked version of fullpage.js]" : "[from git clone box in github][#commit number if required - without this you will get latest tagged version]"
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!