Git 存储库到 package.json 中的依赖项

Viv*_*pta 5 git repository angularjs reactjs package.json

我有一个 git 存储库,并希望将此存储库用作其他项目的 package.json 文件中的依赖项,以便在运行 npm 命令时可以下载它。谁能帮我吗?

Raf*_*zao 6

尝试这个。

"dependencies": {
    "<repo>": "<user>/<repo>#<branch>",
}
Run Code Online (Sandbox Code Playgroud)

例子:

"dependencies": {
   "botkit": "jonchurch/botkit#master",
}
Run Code Online (Sandbox Code Playgroud)

参考资料在这里!


Bjø*_*sen 2

来自NPM 文档

Git URL 作为依赖项

git://github.com/user/project.git#commit-ish
git+ssh://user@hostname:project.git#commit-ish
git+ssh://user@hostname/project.git#commit-ish
git+http://user@hostname/project/blah.git#commit-ish
git+https://user@hostname/project/blah.git#commit-ish
Run Code Online (Sandbox Code Playgroud)