[英]Using branch code in package.json from git
we are working on node.js application and I consume my colleges package which is published to npm, now he create new Git branch (let's call it second) there is a way to somehow c onsume it in the package.json without publish it to npm ? 我们正在使用node.js应用程序,并且我使用了发布到npm的我的大学包,现在他创建了新的Git分支(我们称之为第二分支),有一种方法可以在package.json中使用它而不将其发布到npm ? ( I just want to test the new branch )
(我只想测试新分支)
update I try something like 更新我尝试类似的东西
"git://github.mycompany.corp/vv/app.js.git#newbranch"
and its not working any idea ? 它不起作用吗?
您可以通过以下指定格式添加依赖项来在包json中使用特定的github分支:
git://github.com/<user>/<project>.git#<branch>
so one way is to take the clone of the whole project and Try these steps 所以一种方法是克隆整个项目并尝试这些步骤
1) Fetch all the branches 1)获取所有分支
git fetch origin
2) checkout to your second branch 2)结帐到第二个分支
git checkout <second branch name> like
git checkout second
3) now test the second branch 3)现在测试第二个分支
Other way could be to use git subModules to include the package as the submodule in your project Please refer this link: 其他方法可能是使用git subModules将包作为子模块包含在您的项目中,请参考以下链接:
https://git-scm.com/book/en/v2/Git-Tools-Submodules
git submodule add git://github.mycompany.corp/vv/app.js.git#newbranch git子模块添加git://github.mycompany.corp/vv/app.js.git#newbranch
and then referrence package.json from there and test this. 然后从那里引用package.json并进行测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.