我在 Gitlab 中有几个包,我需要在我的内部项目中使用这些包,NPM 与标签完美配合,但我无法为每个提交创建标签。
"dependencies": {
"XX-alert": "git+http://git.domain.com/XX-platform/XX-alert.git",
...
}
Run Code Online (Sandbox Code Playgroud)
有什么办法强制 NPM 从上次提交重新下载包吗?
您可以通过将提交哈希附加到安装命令来指定提交哈希,例如对于 github
npm install github:<githubname>/<githubrepo>[#<commit-ish>]
Run Code Online (Sandbox Code Playgroud)
所以你将依赖路径替换为
git+http://git.domain.com/XX-platform/XX-alert.git#commit-hash
Run Code Online (Sandbox Code Playgroud)
并npm install下载它