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

前端 未结 1 1130
傲寒
傲寒 2021-02-01 13:29

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

1条回答
  •  醉话见心
    2021-02-01 14:15

    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.

    0 讨论(0)
提交回复
热议问题