Skip to content

patch-package should support patching itself in postinstall script #203

Open
@pdcastro

Description

@pdcastro

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.) :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions