是否有可能像 npm 包一样获取 git 依赖项的更新行为?
所以我有 git 依赖:
"dependencies": {
"my-module": "github:me/my-module"
}
并希望每次执行 npm install
时都更新它,添加修订散列是解决方案,但每次在 github 上更新包时都需要做更多工作来跟踪和更新 package.json。
还有 git 标签(也可以使用 npm version..
命令设置 - 它创建了带有标签 v1.2.3
的提交。所以我想也许他们是如何在 dependents package.json 中使用这个标签?
希望我说清楚了。
repo 上的 git 标签给了我
v1.0.1 v1.0.0 ..
如果我尝试在模块名称版本之后添加 package.json,例如:#1.0.0 或 #v1.0.1
```
"dependencies": {
"my-module": "github:me/my-module#1.0.1"
}
```
安装失败并出现错误:
Command failed: git -c core.longpaths=true rev-list -n1 1.0.0
fatal: ambiguous argument '1.0.0': unknown revision or path not in the
ree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
If you need help, you may report this error at:
<https://github.com/npm/npm/issues>
...
最佳答案
可以这样做
"我的模块": "git+https://github.com/user/repo.git#v1.2.3"
关于node.js - 在 package.json 中使用 git 标签(用于 git 依赖项),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35228918/