ds300 / patch-package

Fix broken node modules instantly 🏃🏽‍♀️💨
MIT License
10.47k stars 295 forks source link

Warn when patch exists for old version of package #498

Closed Daniel15 closed 1 year ago

Daniel15 commented 1 year ago

At Meta, I've seen a few cases where a package was updated but the patch wasn't redone for the new version. It would be nice for patch-package to warn on install/upgrade if a patch exists for an older version of an installed package. Something like this maybe:

Package foo has a patch for version 1.0, but version 2.1 is currently installed. Do you need to create a patch for the new version?

karlhorky commented 1 year ago

@Daniel15 not sure if I'm understanding your description above, but as far as I understand I've never had this problem, and use patch-package actively, with many package upgrades per week.

Do you think it could have anything to do with the current bug of outdated patches not being removed?

Daniel15 commented 1 year ago

@karlhorky The problem is that people don't even know the patch exists, and when they update a package, they don't know that they have to re-do the patch. A big warning at some point (like when doing an upgrade or when it deletes the old patch) would help.

karlhorky commented 1 year ago

they have to re-do the patch

Hm yeah here's the divergence - this does not happen for us.

What has happened in our projects (since years) is that the patch for the old version is still applied to the new version, with a warning that the versions don't match. (unless the patch doesn't apply, in which case patch-package does fail with a big red error)

karlhorky commented 1 year ago

There is also a flag to turn the warning mentioned in my previous comment into an error.

Daniel15 commented 1 year ago

I figured this out - We have postinstall scripts disabled for security reasons image

So the only time patch-package was running was during the initial patching, not on package upgrades. doh. I'll see if we can fix this somehow.