从供应商目录为开源包做贡献?开源、做贡献、供应商、目录

2023-09-07 08:56:10 作者:没人爱更要好好爱自己

理想情况

在处理 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).

问题

如果没有作曲家在下一次更新时吓坏了,我无法更改供应商目录.如果我提交拉取请求,那么我可能需要相当长的时间才能真正在供应商中使用代码,这实际上是对贡献我的新功能的一种阻碍.

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.

我现在怎么做

我通常为捆绑包做贡献的方式是创建一个分支,将分支放入准系统 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 中分叉?

Put fork in composer.json?

我能想到的唯一解决方案是删除我正在编辑的包的 packageagist 依赖项,然后将我的 fork 与来自 github 的 composer(作为一个包)包括在内.这样我可以立即获得我的代码并且仍然可以贡献.

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