nx
nx copied to clipboard
feat(core): add bun package manager
Bun uses yarn lock for it's binary file. Running the binary will produce the content of a yarn lock file (v1)
Other option is to use the -y command on add and install. This will create a yarn lock file and then createLockFile can just modify the yarn.lock file instead?
This is the PR made from #19113 and pushed due to #22402 being closed.
PS Bun feels more stable since the PR was first created!
This PR will resolve #22283 and start of #21075
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
Name | Status | Preview | Updated (UTC) |
---|---|---|---|
nx-dev | ⬜️ Ignored (Inspect) | Visit Preview | May 22, 2024 2:58pm |
☁️ Nx Cloud Report
CI is running/has finished running commands for commit 631c414c2ce8b80bd7e72bfc0d769378ab06c7fa. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.
📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 6 targets
-
nx affected --targets=e2e,e2e-ci --base=08ef0e4bde845669b9cfef183d50c856e7a6293f --head=631c414c2ce8b80bd7e72bfc0d769378ab06c7fa --parallel=1
-
nx run-many -t check-imports check-commit check-lock-files check-codeowners documentation --parallel=1 --no-dte
-
nx affected --targets=lint,test,build --base=08ef0e4bde845669b9cfef183d50c856e7a6293f --head=631c414c2ce8b80bd7e72bfc0d769378ab06c7fa --parallel=3
-
nx-cloud record -- nx format:check --base=08ef0e4bde845669b9cfef183d50c856e7a6293f --head=631c414c2ce8b80bd7e72bfc0d769378ab06c7fa
-
nx documentation --no-dte
-
nx affected -t e2e-macos-ci --parallel=1 --base=08ef0e4bde845669b9cfef183d50c856e7a6293f --head=631c414c2ce8b80bd7e72bfc0d769378ab06c7fa
Sent with 💌 from NxCloud.
cc: @JamesHenry
I was working in WSL. I'll fix the test in the morning on my Linux laptop
@JamesHenry I think this is all good now. The failed test is due to snapshot changes. Are you happy with me just updating the snapshot?
I am looking at the pruning. Never looked at zig code but it wonder if porting this would help https://github.com/oven-sh/bun/blob/main/src/install/lockfile.zig
@meeroslav happy to follow up with that too. Was thinking of a PR for bun itself but it may need some design consideration (ie inside js for executors or inside a standalone bun plugin.
I am looking at the pruning. Never looked at zig code but it wonder if porting this would help https://github.com/oven-sh/bun/blob/main/src/install/lockfile.zig
Unless they have an npm package that exposes generator as a Node function, we don't want to "reimplement" it within Nx. For the time being, we can use yarn lock file generation and once there is a way for bun
to generate a lock file without running the install we'll switch to that.
Something like bun install --lock-file-only
or bun install --prune
would be perfect.
One thing I noticed when testing locally is that setting local registry in $HOME/.bunfig.toml
didn't always work for me unless I run bun install --no-cache
. Not sure what the issue it, but perhaps it's related to https://github.com/oven-sh/bun/issues/4901.
This would affect e2e testing because we need to set it to:
// $HOME/.bunfig.toml
[install]
registry = "http://localhost:4873"
One thing I noticed when testing locally is that setting local registry in $HOME/.bunfig.toml
didn't always work for me unless I run bun install --no-cache
. Not sure what the issue it, but perhaps it's related to https://github.com/oven-sh/bun/issues/4901.
This would affect e2e testing.
@jaysoo one thing I haven't done is update verdaccio to edit bunfig.toml to add a custom registery
One thing I noticed when testing locally is that setting local registry in
$HOME/.bunfig.toml
didn't always work for me unless I runbun install --no-cache
. Not sure what the issue it, but perhaps it's related to oven-sh/bun#4901.This would affect e2e testing because we need to set it to:
// $HOME/.bunfig.toml [install] registry = "http://localhost:4873"
I believe this is by design. When you say it wasn't working what do you mean? By default bun always go to cache as long as the major version is matching
@jaysoo one thing I haven't done is update verdaccio to edit bunfig.toml to add a custom registery
We should do this here or as a follow-up to add bun to nightly tests, since it will be needed there.
I believe this is by design. When you say it wasn't working what do you mean? By default bun always go to cache as long as the major version is matching
I would publish a new version (e.g. 19.0.0
) locally, update .bunfig.toml
, then run bun install
. The install fails due to 19.0.0
not being on npm registry, so I have to pass --no-cache
to make it work. Seems like a bug, but it's nothing to do with Nx, we can just always run with --no-cache
for e2e tests.
I'll update the test shortly. Is they anything else we need for this or want me to look at?
I'll update the test shortly. Is they anything else we need for this or want me to look at?
I think we're good. When we enable nightlies we'll make sure all the local registry support is there as well.
I'm happy adding that now if you show me where
I'm happy adding that now if you show me where
@Jordan-Hall not need, we'll do that in a separate PR. Let's get this one over the line
@meeroslav any chance you can update that last remaining snapshot for me. Sorry on windows and snapshot changes too much compared to doing it on linux. Not got my linux laptop on me sorry
So latest pr revase broke it again -_- let me know when you want this in / ready and I'll fix it again.
So latest pr revase broke it again -_- let me know when you want this in / ready and I'll fix it again.
Looks like it's green now. I'll do more testing on it, it looked good during my last test. If it's good, we can probably get it in for Nx 19.
So latest pr revase broke it again -_- let me know when you want this in / ready and I'll fix it again.
Looks like it's green now. I'll do more testing on it, it looked good during my last test. If it's good, we can probably get it in for Nx 19.
Thank you. Let me know if you find any issues. Next stop bun executors 😅
Is there an ETA on when this can be merged in and be usable? I'm starting a new React/React Native project for my company this week or next and I really want to use Bun + Nx 👀
If I decided to go with an alternative package manager just to get the project started (like pnpm
for example), would it involve significant overhead to switch over to Bun?
Is there an ETA on when this can be merged in and be usable? I'm starting a new React/React Native project for my company this week or next and I really want to use Bun + Nx 👀
If I decided to go with an alternative package manager just to get the project started (like
pnpm
for example), would it involve significant overhead to switch over to Bun?
As far as I know, bun cannot change pnpm lockfile to bun lockfile. so I would choose classic npm to start with. (also workspaces in pnpm are a little bit different too)
Pushed one more fix and doing more testing. We're ready to merge Nx 19 features, so we should be merging this very soon.
Quick update on this PR, we are planning to include this in Nx 19.1 rather than 19. The reason is that Nx 19 is a stability release to address some issues around Project Crystal, so we're pushing some new features to Nx 19.1, including Bun.
@jaysoo any update or indication when this will land in 19.1 (beta)?
@jaysoo any update or indication when this will land in 19.1 (beta)?
I think we can merge it soon once green again.
@Jordan-Hall please complete https://github.com/Jordan-Hall/nx/pull/2/
@Jordan-Hall please complete Jordan-Hall#2
I'll sort it later. I was going to fix this tonight when little one asleep. Sorry didn't get any notification
@Jordan-Hall please complete Jordan-Hall#2
I think i want @jaysoo view on this. Now that you have added getRegistryUrl. How do you want to do this in bun as it doesnt have the same support