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

feat: support initializing with Bun #1366

Closed
Zeko369 opened this issue Apr 18, 2023 · 4 comments · Fixed by #1375
Closed

feat: support initializing with Bun #1366

Zeko369 opened this issue Apr 18, 2023 · 4 comments · Fixed by #1375
Labels
🔰 good first issue Good for newcomers 🌟 enhancement New feature or request 👨‍👦‍👦free for all Anyone is free to take on this issue and file a PR

Comments

@Zeko369
Copy link
Contributor

Zeko369 commented Apr 18, 2023

Provide environment information

System:
OS: macOS 13.4
CPU: (8) arm64 Apple M1
Memory: 102.36 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.18.0 - ~/Library/Caches/fnm_multishells/78864_1681854261277/bin/node
npm: 8.19.2 - ~/Library/Caches/fnm_multishells/78864_1681854261277/bin/npm
Watchman: 2023.01.02.00 - /opt/homebrew/bin/watchman

Describe the bug

If running create-t3-app with bunx it defaults to installing depends with npm rather than bun install

To reproduce

bunx create-t3-app

Should prompt for "install depends with bun" instead of npm

Additional information

I have a patch ready if you're ok with this change, the performance diff is massive...

CleanShot 2023-04-19 at 00 13 20

@c-ehrlich
Copy link
Member

c-ehrlich commented Apr 19, 2023

Until now our approach has been mostly about consistency. If you run the cli with pnpm, we assume you also want to use that as your package manager, and run your app with it. Same for npm and yarn. Bun cannot currently be used as an end to end solution. You can use it to init and install dependencies, but as far as I can tell if you try to run the dev server with it, it will start it but fail to serve requests correctly.

I can see why people would want to use it as their init tool / package manager, but we also have to be careful about being clear that you can't run your app with it after you're done bootstrapping.

Sorry for the vague answer, I don't have a well defined opinion on this, let's see what others think :)

@Zeko369
Copy link
Contributor Author

Zeko369 commented Apr 19, 2023

Bun cannot currently be used as an end to end solution. You can use it to init and install dependencies, but as far as I can tell if you try to run the dev server with it, it will start it but fail to serve requests correctly.

Yes you can't use custom bun dev server to run a next app (at least not fully and not yet)

But it's the same as with pnpm, (you're not running the app with pnpm it's running with node, just being called from pnpm), while bun has a dev server (bun dev that's not yet stable) running bun run dev is the same as npm run dev / pnpm run dev / yarn dev

Also using tools like ni the nr commend is an alias for npm run / pnpm run / bun run

TLDR; While Bun has a WIP dev server it can be used exactly as pnpm

  • pnpm install -> bun install
  • pnpm dlx -> bunx
  • pnpm run dev -> bun run dev

@yaikohi
Copy link

yaikohi commented Apr 29, 2023

One of the other reasons why you cannot run t3-app with bun is because prisma doesn't work with bun yet.
There is an issue at oven-sh/bun where the prisma compatibility is being tracked, so I am just going to link that here.

oven-sh/bun#2083

@Zeko369
Copy link
Contributor Author

Zeko369 commented Apr 29, 2023

I know prisma doesn't work / also next itself has a fork with a subset of features that works under bun, but that's what this issue / PR are about

Bun isn't just a node/deno replacement, it has a super fast package manager you can use with any node project (just like you don't run your code with pnpm you install your packages with it, you can use bun to just install packages)

https://bun.sh/docs/cli/install
https://twitter.com/jarredsumner/status/1606163655527059458

@juliusmarminge juliusmarminge changed the title bug: bun install isn't detected when creating an app feat: support initializing with Bun Jun 4, 2023
@juliusmarminge juliusmarminge added 🌟 enhancement New feature or request 🔰 good first issue Good for newcomers 👨‍👦‍👦free for all Anyone is free to take on this issue and file a PR and removed 🐞❔ unconfirmed bug labels Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔰 good first issue Good for newcomers 🌟 enhancement New feature or request 👨‍👦‍👦free for all Anyone is free to take on this issue and file a PR
Projects
None yet
4 participants