patch-package should support patching itself in `postinstall` script
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 325
- PR merge metrics
- No merged PRs in 30d
Description
`patch-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.) :-)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.