vercel/turborepo

Support bun (bun.sh)

patlux opened this issue ยท 12 comments

Which project is this feature idea for?

Turborepo

Describe the feature you'd like to request

If I set "packageManager": "bun@0.5.9" in my package.json and run turbo, I get:

$ turbo run lint
 ERROR  run failed: could not detect yarn version: exit status 1
Turbo error: could not detect yarn version: exit status 1
error: script "lint" exited with code 1 (SIGHUP)

Describe the solution you'd like

It should support bun.

Describe alternatives you've considered

None

Hey @patlux thanks for the suggestion! I'll bring this up with the team. I imagine that (1) we're open to a contribution here or (2) we'll wait till after the Rust port to complete before attempting to add a new package manager.

Hey @patlux we talked about this at our team meeting today. It looks like one of the major initial differences is that bun generates a binary lockfile. Other than just detecting that file to infer bun is the package manager, we also need to be able to parse that file to generate a workspace graph, which is a pretty significant effort.

We are watching bun adoption and demand for this feature. If this issue gets a lot of interest we will consider adding support for it.

Thanks again for filing an issue!

@mehulkar Thank you for sharing the info!

There is also the option to generate a yarn.lock-file when running bun install. So I think for the beginning it would be totally fine to use bun install --yarn and use the generated yarn.lock-file. What do you think?

this was mentioned today in buns discord
i want to note that if you run "bun ./bun.lockb", bun will print out a yarn yaml lockfile to stout, which can be parsed using the same code assuming yarn is supported.

this was mentioned today in buns discord
i want to note that if you run "bun ./bun.lockb", bun will print out a yarn yaml lockfile to stout, which can be parsed using the same code assuming yarn is supported.

Was looking for this comment. Could there be more info on using turbo and bun?

Any movement on this? Vercel now supports it for deploys: https://vercel.com/changelog/bun-install-is-now-supported-with-zero-configuration

Hey everybody, be assured that we're looking into this. Currently bun does not have support for a large number of monorepo things: oven-sh/bun#533 (comment)

We have an experimental integration which works well, but due to missing features in bun we are unable to ship it.

For example, in a create-turbo monorepo, the most-significant blocker (and one we can't work around): cd apps/docs && bun run build doesn't work. bun can't presently execute workspace scripts, which are a cornerstone of Turborepo's execution strategy.

I suppose this does not suffice?
oven-sh/bun#5071
oven-sh/bun@6e4f746

@nathanhammond Love to see you doing the grunt work on the bun project to make this happen. It's really appreciated. ๐Ÿฅ‚

sgup commented

Would be super helpful to have docs on how to use Turbo, Bun, and Github Actions together:
https://turbo.build/repo/docs/ci/github-actions

image

Has anyone been able to successfully use @nathanhammond's work to use Bun with Turborepo v2? If anyone can guide me how to do it I'd be more than happy to add a PR with documentation on it.