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
feat(core): add bun package manager #22602
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
if (packageManager === 'bun') { | ||
output.log({ | ||
title: | ||
"Unable to create bun lock files. Run bun install it's just as quick", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edbzn Would it be worth calling stringifyYarnLockfile? But would have to edit how it is created into a file because it is a self-executable file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking is moving the following into a util
const lockFile = createLockFile(
builtPackageJson,
context.projectGraph,
packageManager
);
writeFileSync(
`${outDirRelativeToWorkspaceRoot}/${getLockFileName(packageManager)}`,
lockFile,
{
encoding: 'utf-8',
}
);
its duplicated code but run IF check for bun and use the bun CLI to generate the binary file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth asking @meeroslav, he knows best how to deal with lockfiles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should reuse stringifyYarnLockfile
to parse the file, as long as it handles bun-specific strings: # bun
at the top, and version "workspace:<proj>"
if using bun workspaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there doesn't seem to be a way to generate bun.lockb
without running the install, I would use the stringifyYarnLockfile
to be as close as possible to the intended package versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm looking at generating the binary file. Happy to update snapshot so this can go in and work on that after? Also love to get involved in adding runtime and bun test. I have plugin that does it for now, but be nice if NX can add native support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaysoo If you want to make the yarn.lock a follow up then I think this PR is completed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reused Yarn in my PR bro. They still had problems with it. The people want Bun support!
If it builds and runs, then that's a start.
Help us brothers out for taking the time to do this for you.
It was my birthday btw when I built a working version for your project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is different, this is to handle the manual creation of lock files not the reading of the lock file. Nx team doing a great job BTW, they been so many unstable issues. The chunk of this was taken from my PR back in Sep 11, 2023. But I closed it due to Bun having too many bugs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@laynef you can always use nx-bun to get started for now
cc: @JamesHenry |
71efdf9
to
d0eb306
Compare
d0eb306
to
743444b
Compare
I was working in WSL. I'll fix the test in the morning on my Linux laptop |
743444b
to
b90d256
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this @Jordan-Hall!
We will need some e2e coverage in addition to the comments
4dd5910
to
99421c3
Compare
3f7800c
to
9362912
Compare
So latest pr revase broke it again -_- let me know when you want this in / ready and I'll fix it again. |
9362912
to
f8de382
Compare
2f28cfb
to
57480d9
Compare
761923f
to
fe4ef4a
Compare
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 |
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. |
503bc40
to
59b41ab
Compare
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. |
Bun uses yarn lock for it's binary file. Running the binary will produce the content of a yarn lock file (v1)
feat(core): check lock file for bunlock on push Signed-off-by: Jordan Hall <[email protected]>
59b41ab
to
46516c8
Compare
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