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

chore: use bun as package manager #609

Closed
wants to merge 15 commits into from
Closed

chore: use bun as package manager #609

wants to merge 15 commits into from

Conversation

juliusmarminge
Copy link
Member

@juliusmarminge juliusmarminge commented Sep 15, 2023

Might be a bit unresponsible to use it right away, but seems like a straight forward migration.

Comment on lines 32 to 43
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT

- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stupidly fast without even caching (or maybe the action does this automatically)
CleanShot 2023-09-15 at 09 14 45@2x

@juliusmarminge
Copy link
Member Author

juliusmarminge commented Sep 17, 2023

For those lurking this PR, there are a few features that I would like to see supported in Bun before I can recommend it over pnpm:

  • workspace filters (pnpm -F db db:studio)
    • you can run with turbo filters but sometimes you want to run something without turbo
  • patches (you can work around it by using a yarn lockfile but i like built in support)
  • overrides / resolutions
    • nested overrides, I've found the limitation of Bun only being able to ocerride 1 level deep quite limiting... (e.g overriding @auth/core used by next-auth doesnt work)

@juliusmarminge
Copy link
Member Author

juliusmarminge commented Nov 1, 2023

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @juliusmarminge and the rest of your teammates on Graphite Graphite

@estubmo
Copy link

estubmo commented Feb 28, 2024

  • workspace filters (pnpm -F expo dev)

Related issues in the bun repo:

oven-sh/bun#5793
oven-sh/bun#5207

This might be a workaround:

You can create your own workspace filter while this is under development:

in package.json:

{
  "scripts": {
    "workspace": "bun ./scripts/workspace.ts"
  }
}

./scripts/workspace.ts

File content
Then you can run workspaces with bun run workspace <workspace-script>.

Here's an example of a project using workspaces with bun:

https://github.com/rehype-pretty/rehype-pretty-code/blob/4a41af0c8fb706e26bdd00aec54b9bc384fc318a/package.json#L28 https://github.com/rehype-pretty/rehype-pretty-code/blob/master/scripts/workspace.ts

Although I believe it would not support wildcard paths.

  • patches (you can work around it by using a yarn lockfile but i like built in support)

oven-sh/bun#2336

Possible workaround:

  1. bun add -D patcheer postinstall-postinstall
  2. bunx patcheer copy <package_name>
  3. Make your tweaks in ./patches/<package_name>
  4. bunx patcheer apply
  5. Add "postinstall": "bunx patcheer apply" to your scripts in your package.json.
  6. Make your build command on your host bun install.

This should work locally and in any hosting env that supports Bun (i.e. it's working on Vercel for me). Ping me if something doesn't work.

Although these workarounds might work, it's probably best to wait for any official bun support for filtering workspaces and patching.

@john093e
Copy link

Hello @juliusmarminge,

Is this PR still a work in progress or is it going to be dropped ?
Many thanks!

@juliusmarminge
Copy link
Member Author

juliusmarminge commented Mar 30, 2024

For those lurking this PR, there are a few features that I would like to see supported in Bun before I can recommend it over pnpm:

  • workspace filters (pnpm -F db db:studio)
    • you can run with turbo filters but sometimes you want to run something without turbo
  • patches (you can work around it by using a yarn lockfile but i like built in support)
  • overrides / resolutions
    • nested overrides, I've found the limitation of Bun only being able to ocerride 1 level deep quite limiting... (e.g overriding @auth/core used by next-auth doesnt work)

These things are still not there + there's some weird quirks with Bun + Turborepo so for now we're "stuck" with pnpm

@john093e
Copy link

Thanks for your super fast reply :)

@juliusmarminge
Copy link
Member Author

gonna close this - bun workspaces still feel quite far out to being production ready imo and the bun package manager doesn't seem to get enough love by the team to suggest we'll get there in the near future

@kaminskypavel
Copy link

kaminskypavel commented May 13, 2024

gonna close this - bun workspaces still feel quite far out to being production ready imo and the bun package manager doesn't seem to get enough love by the team to suggest we'll get there in the near future

@juliusmarminge - does it mean that
? Which package manager do you want to use? bun workspaces (beta) is obsolete?

@juliusmarminge
Copy link
Member Author

juliusmarminge commented May 13, 2024

gonna close this - bun workspaces still feel quite far out to being production ready imo and the bun package manager doesn't seem to get enough love by the team to suggest we'll get there in the near future

@juliusmarminge - does it mean that ? Which package manager do you want to use? bun workspaces (beta) is obsolete?

i don't control the create-turbo CLI. That's maintained by the Turbo team at Vercel. If you wanna use Bun and live with it's shortcomings that's completely fine but this official template will not adopt it as it stands now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants