Open pdcastro opened 4 years ago
I am about to do similar (attempt to patch patch-package) and I think this is achievable as-is by modifying your postinstall
Specifically,
patch-package-patches
patch-package
, call patch-package --patch-dir patch-package-patches && patch-package
That way your patch-package patches should go in, and should go first, then it will do it's normal run.
Should work?
@mikehardy, great suggestion! I wasn't aware of the --patch-dir
option: it is not documented by npx patch-package --help
, but indeed it is in the source code. I've successfully "solved" issue #201 in my project thanks to your tip. 👍
@pdcastro quick! Propose a PR for the help doc and claim the internet points :trophy: before someone else does :smile: https://github.com/ds300/patch-package/blob/master/src/index.ts#L104
Propose a PR for the help doc and claim the internet points 🏆
@mikehardy, I think you have a rightful claim for those points, 😄 and I am already collecting lots elsewhere at the moment! 💰
Mine all mine, precious internet points https://github.com/ds300/patch-package/pull/225 Cheers :-)
patch-package
is great, so much so that I recently found myself attempting to use it to patchpatch-package
itself as I came across issue #201. It didn't work, at least in my setup, using"postinstall": "patch-package"
in thepackage.json
file. What I think was happening is that by the timepatch-package
had patched itself, it was too late -- the old unpatched code was already being used to patch other packages.Perhaps the solution might be for
patch-package
to detect if one of the patch files is forpatch-package
itself, and if so, apply that patch first, then re-exec itself before continuing with other patches. (When re-exec'ing, perhaps add a command-line option like--no-self-patch
to prevent patching itself in a loop.) :-)