vaimo / composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and composer command for testing/troubleshooting patches.
MIT License
284 stars 40 forks source link

Allows patching of composer.json files? #60

Open claudiu-cristea opened 3 years ago

claudiu-cristea commented 3 years ago

We currently use https://github.com/cweagans/composer-patches but that has a limitation that affects us: you cannot patch the package composer.json. Of course the file is patched but changes are not taken into account when building the dependency tree. I wonder if https://github.com/vaimo/composer-patches knows to resolve that issue.

allanpaiste commented 3 years ago

Hi there!

Unfortunately, this is currently not part of the plugin.

I've not explored this in-depth, but targeting composer.json will definitely be trickier as it's so central to the whole installation process and unlike the normal process of "let the package install, add patches", this would require a "let the package install, patch it, re-install while keeping patched changes".

I'd just take a wild guess and say that it is probably possible, but it's probably going to become a maintenance concern as it'd rely on hovering around Composer internals that normal plugin should not touch.

Curious idea though... (gears starting to grind).


One thing that the plugin SHOULD be doing right now would be to issue a warning at least that patching certain files has no effect which might not be clear right away :S