问题描述
理想情况
经常在 Symfony2 项目中工作时,我会在我的依赖项之一中发现我想要更改的内容.如果我能找到一种方法来简单地在供应商中更改它,然后轻松地将更改作为拉取请求推送,那么我可能会更频繁地做出贡献(而不是用本地子包覆盖该部分).
Often while working on a Symfony2 project I will spot something I want to change in one of my dependencies. If I could find a way to simply change it in vendor and then easily push the changes as a pull request then I would probably contribute more often (rather than overriding the part with a local child bundle).
问题
我无法更改供应商目录,而 Composer 在下一次更新时会吓坏了.如果我提交拉取请求,那么我可能需要很长时间才能在供应商中实际使用代码,这实际上阻碍了我贡献我的新功能.
I can't change a vendor directory without composer freaking out on the next update. If I submit a pull request then it may take quite some time before I can actually use the code in vendors, which is actually a deterrent from contributing my new functionality.
我现在怎么做
我通常为 bundle 做贡献的方式是制作一个 fork,将 fork 放在一个准系统 symfony 标准版应用程序中,进行更改,然后提交拉取请求.
The way I typically contribute to a bundle is to make a fork, put the fork in a barebones symfony standard-edition app, make the change and then submit a pull request.
在composer.json
中加入fork?
Put fork in composer.json
?
我能想到的唯一解决方案是删除我正在编辑的包的 packagist 依赖项,然后将我的 fork 与 Composer(作为一个包)从 github 中包含在内.这样我就可以立即获得我的代码并且仍然可以做出贡献.
The only solution I can think of, is removing the packagist dependency of the bundle I am editing, and then including my fork with composer (as a package) from github. That way I get my code immediately and can still contribute.
这是唯一的解决方案吗?你是怎么做的?
Is this the only solution? How do you do it?
在同时处理不同项目的同时为捆绑包做出贡献的任何提示/建议将不胜感激!
Any tips/advice for contributing to a bundle while working on a different project at the same time would be appreciated!
推荐答案
[更新:回答不再有效]
正如其中一条评论所指出的,这个答案已经有几年了,不再正确.请参阅下面的答案以了解正确的继续操作方式.
As pointed out in one of the comments, this answer is a couple years old and not correct anymore. See answers below for the correct way to proceed.
[下面的原始答案]
这是作曲家的创造者 Jordi Boggiano (@Seldaek) 推荐的方法.从他今年早些时候在 Symfony Live San Francisco 上的演讲中看到(2 分钟标记处):http://www.youtube.com/watch?list=PLo7mBDsRHu11ChvScWUE7MN1Qo5QVHQEz&feature=player_detailpage&v=P3NwF8RV1lY#t=120s
This is the approach recommended by Jordi Boggiano (@Seldaek), creator of composer.See from his talk at Symfony Live San Francisco earlier this year (at the 2 minutes mark):http://www.youtube.com/watch?list=PLo7mBDsRHu11ChvScWUE7MN1Qo5QVHQEz&feature=player_detailpage&v=P3NwF8RV1lY#t=120s
这篇关于为来自供应商目录的开源包做出贡献?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!