composer-patches
composer-patches copied to clipboard
Feature: Add command to generate patches
It'd be great if there was a way to create patches within this plugin.
There's an NPM package called patch-package which does this in the NPM/Node ecosystem. The way it works is you make changes to the file(s) in the node_modules directory then run a command like:
npx patch-package package-name
The package then performs the following steps:
- Downloads the
package-name
package at the same version in the project's lock file to a temporary directory - Diffs the "clean" package against the version in node_modules and creates a patch file in a
patches
directory in the project root - Deletes the temporary directory
I was wondering whether there's any scope for doing that within this project? I'd be happy to give it a go and submit a PR but would like some feedback before starting :)
I see it working pretty similarly to the above method, with the addition of adding an entry to the extra.patches
object in composer.json
@andyexeter Hi! I've had the exam same feeling as you, and found this package that does exactly like the patch-package
: https://github.com/symplify/vendor-patches, it actually uses underneath this package, so all is great! 🥳
@Liinkiing Thanks! That package looks awesome. I will keep this issue open for the time being, to see if the maintainer of this package would like this sort of functionality natively.
I'd rather keep this plugin focused on applying patches, rather than generating them.