gpt4 book ai didi

git - NPM 包 url 作为 mercurial(bitbucket) 中的依赖项

转载 作者:太空狗 更新时间:2023-10-29 12:51:03 24 4
gpt4 key购买 nike

我已经搜索了这个主题很长时间,目前所有的解决方案和示例都在 git 中工作,但没有针对 Mercurial 的直接解决方案。

取自类似链接的工作示例。

"private": true
to your package.json

Then to reference private npm module in package.json

{
"name": "myapp",
"dependencies": {
"private-repo": "git+ssh://git@github.com:myaccount/myprivate.git#v1.0.0",
}
}

正如我从官方 npm 页面上读到的,这一切只适用于 git https://docs.npmjs.com/files/package.json#git-urls-as-dependencies

那么如何在 Mercurial 中做同样的事情,或者目前似乎只有 Git 才有可能?

最佳答案

如果您正在使用Bitbucket要托管项目的 Mercurial 存储库,它确实提供了将项目快照下载为 tar.gz 文件的链接。这些网址 are actually usablepackage.json 依赖项中。

例如,我的pagedown 项目的download page有指向此 URL 的链接,用于获取最新 default 分支更改的 gzip 快照:

https://bitbucket.org/ncraike/pagedown/get/default.tar.gz

所以在另一个项目的package.json中,我可以指定:

"dependencies": {
"pagedown": "https://bitbucket.org/ncraike/pagedown/get/default.tar.gz"
}

当我从依赖包执行 npm install 时,npm 处理得很好,将它正确安装到 node_modules 子目录。

这不是 Mercurial 存储库的通用解决方案(我同意如果 npm 也接受 Mercurial URL 会很好)但是如果您使用 Bitbucket 或类似的站点进行托管,这可能是一个合理的解决方法。

关于git - NPM 包 url 作为 mercurial(bitbucket) 中的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18208860/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com