Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bun patch is a DX regression compare to patch-package #12256

Open
ArnaudBarre opened this issue Jun 30, 2024 · 4 comments
Open

bun patch is a DX regression compare to patch-package #12256

ArnaudBarre opened this issue Jun 30, 2024 · 4 comments
Labels
bug Something isn't working needs triage

Comments

@ArnaudBarre
Copy link
Contributor

What version of Bun is running?

1.0.17

What platform is your computer?

No response

What steps can reproduce the bug?

bun patch <package>

What is the expected behavior?

Diff the package and commit the patch

What do you see instead?

To patch typescript, edit the following folder:
...

Additional information

What I really like about bun is that it's a faster yarn v1. It let me have a dead simple node_modules, without messing with resolutions. I've used bun for a long time with patch-package and the flow was to first debug the node_modules, then when I'm done I run the patch command.

This flow feels like yarn v2+/pnpm where you first need to run the patch to some temporary package outside of your workspace and then commit back 🤮

I'm logging this as an issue given that DX is part of bun core values.

@ArnaudBarre ArnaudBarre added bug Something isn't working needs triage labels Jun 30, 2024
@Jarred-Sumner
Copy link
Collaborator

We could add a bun patch --commit --force subcommand for those on macOS not using hardlinks to install. The problem with editing it directly on Linux or Windows is we use hardlinks to install packages by default. This means that editing the package there will also edit the cached on-disk version and that means it will effect every installed copy. We haven't come up with a way to preserve the fast install speeds while also allowing editing in-place

@ArnaudBarre
Copy link
Contributor Author

ArnaudBarre commented Jun 30, 2024

Oh I see, I though this was like this on linux too. I'm happy to be on Mac OS.
Can't the command detect the current backend and commit directly?

@Jarred-Sumner
Copy link
Collaborator

Can't the command detect the current backend and commit directly?

Unfortunately, not always. You could install from a USB stick. You could install from a network drive. The package could be a symlink to a network drive. You might be on a very old HFS+ volume. These are all edgecases, but we only know what was used at the time of install

@ArnaudBarre
Copy link
Contributor Author

ArnaudBarre commented Jun 30, 2024

It means that a install folder can contains a mix of multiple backend if install was done with one but a package was added with another later? There is no way to be sure a folder is not a hardlink/symlink on Mac?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

2 participants