oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.07k stars 2.67k forks source link

Improve DX of patching when updating packages #13397

Open brettwillis opened 3 weeks ago

brettwillis commented 3 weeks ago

What is the problem this feature would solve?

Currently, patches are locked to a specific version of a package. If that package gets updated, Bun will silently stop applying the patch with no warnings or errors. If the patched package is a transitive dependency this is even worse.

Incredibly easy to break the application without knowing.

Furthermore it's hard to recreate the patch file. We have to manually re-patch the package from scratch every time it is updated.

pnpm has the allowNonAppliedPatches which will at least error when the patch becomes outdated.

But I think that patch-package is the gold-standard here when it comes to DX, where we have the following behaviour

  1. Non-applied patches error by default
  2. Updating the patch for the new version is as simple as rerunning the command (if patch is still compatible)

What is the feature you are proposing to solve the problem?

  1. Maybe introduce allowNonAppliedPatches and I'd advocate for enabling it by default.
  2. Maybe provide a command for migrating patches to a new version.

What alternatives have you considered?

No response

kravetsone commented 3 weeks ago

Yeah it will be cool!