patch-package should support patching itself in `postinstall` script
See original GitHub issuepatch-package
is great, so much so that I recently found myself attempting to use it to patch patch-package
itself as I came across issue #201. It didn’t work, at least in my setup, using "postinstall": "patch-package"
in the package.json
file. What I think was happening is that by the time patch-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 for patch-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.) 😃
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Super Easy NPM Package Patching with 'patch-package'
How to use. To use patch-package, make your changes right in the package code in node_modules and run patch-package . That's it! It'll...
Read more >The easiest way to patch your npm package when there is a
The easiest way and actually most devs do, is go to Github's package repository and log a bug. The real problem with that...
Read more >patch-package - npm
patch -package lets app authors instantly make and keep fixes to npm dependencies. It's a vital band-aid for those of us living on...
Read more >Not able to include package.json in the patch #49 - GitHub
TL,DR: What would be the way to include package.json in the patch? ... yarn.lock anyway :( It makes sense, as it run a...
Read more >patch-package in React Native - Anu Thomas - Medium
If we are running patch-package without any arguments, it will apply all patches in your project. We can give options also. The options...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mikehardy, great suggestion! I wasn’t aware of the
--patch-dir
option: it is not documented bynpx patch-package --help
, but indeed it is in the source code. I’ve successfully “solved” issue #201 in my project thanks to your tip. 👍Mine all mine, precious internet points https://github.com/ds300/patch-package/pull/225 Cheers 😃