Update bundle mode patch guide to add bun patching instructions#9818
Update bundle mode patch guide to add bun patching instructions#9818acarlson33 wants to merge 6 commits into
Conversation
Added instructions for using bun with patch-package for better compatibility and performance.
|
You don't need patch-package with bun. Just apply them with git and commit. # download patches
curl -fsSLO https://github.com/software-mansion/react-native-reanimated/raw/refs/heads/main/packages/react-native-worklets/bundleMode/patches/patch-package/metro-runtime/metro-runtime+0.84.4.patch
curl -fsSLO https://github.com/software-mansion/react-native-reanimated/raw/refs/heads/main/packages/react-native-worklets/bundleMode/patches/patch-package/metro/metro+0.84.4.patch
# apply
bun patch metro-runtime #optional... if you know the package is clean, you can skip
(cd node_modules/metro-runtime apply ../../metro-runtime+0.84.4.patch)
bun patch --commit metro-runtime
bun patch metro
(cd node_modules/metro && git apply ../../metro+0.84.4.patch)
bun patch --commit metro
# cleanup
git add patches package.json
git commit -m "chore: patch metro"
rm ,/metro*.patch |
Updated bun patching instructions to not rely on patch-package and instead use `git apply` to apply the patches before committing them with bun.
Thanks for that, I doubt I would have figured out there would be a way to do it with git as I don't patch packages super often. I refactored the doc to include that instead of using |
Added instructions to return to project root before applying patches. Also added step 8 to optionally remove old `patch-package` patches in favor of bun's generated patches only.
the rm command just removes the downloaded source patches. you don't want to delete the files in the patches directory that bun creates. |
|
The command I made filtered the patches by whether or not the patch files have the |
|
@acarlson33 yes, you are correct. My example put the source patches in a different directory to avoid the collision, and so it didn't need to handle the filter. I probably should have output to |
Added instructions for using bun without
patch-packagefor better compatibility with bun.Summary
There weren't any instructions for patching bun repositories, and
patch-packageby itself doesn't work because in monorepos at least, bun installs deps into the.bunfolder inside ofnode_modules, which breakspatch-package. I added a section to the patching instructions that details how to use bun's built in patching mechanisms along with git to make the patches for bun monorepos with isolated linking.Test plan
This is just a documentation change, but I've verified the patches are successful, and you can do so by following the instructions added into the file.