简体   繁体   English

在git的package.json中使用分支代码

[英]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.

相关问题 具有GIT工作流程的Package.json-开发和主分支的独立依赖项 - Package.json with GIT Workflow - Separate dependency for develop and master branch CI-在其他分支中使用正确的package.json - CI - Using the right package.json while in other branch 使用angular库与直接从package.json中的git引用它的优缺点是什么 - What are pros and cons of using angular library vs directly referring it from git in package.json 使用node package.json创建git repo - Create git repo using node package.json 有没有办法从 nodejs 代码中的 package.json 获取版本? - Is there a way to get version from package.json in nodejs code? package.json 中 git 依赖项的权限被拒绝 - Permission denied for git dependencies in package.json 使用jq从package.json中提取有关依赖项的信息 - Using jq to extract information about dependencies from package.json Nodemon 无法在 ZC5FD214CDD0D2B3B4272E73B022 上使用来自 package.json 的 npm 脚本工作 - Nodemon not working using npm script from package.json on Docker 在package.json中使用git标签(用于git依赖项) - Use of git tags in package.json (for git dependencies) 如何在npm package.json git项目中更新Git Hash? - How To Update Git Hash in npm package.json git project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM