Skip to content

Commit 7492f71

Browse files
authored
fix(create-waku): Fix detection of bun using npm_config_user_agent env var (#1268)
I noticed that running `bun create waku@latest` and `bunx create-waku@latest` didn't seem to detect `bun` as the package manager as expected based on my changes in #1229. However - I was able to verify that both formats should work when I tested with a new dummy package: `create-debug-create` ```sh bun create debug-create@latest # and bunx create-debug-create@latest ``` will print some things to the console (e.g. `process.env`, `process`, etc). Based on running both of those - it seems like the `npm_config_user_agent` env var _does_ get populated with `bun` as expected (not sure how I was testing before where it didn't work - maybe just with running the CLI directly via `bun ./cli.mjs`?)
1 parent 563b036 commit 7492f71

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

packages/create-waku/src/index.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ import {
1919

2020
const userAgent = process.env.npm_config_user_agent || '';
2121

22-
// Bun doesn't update `npm_config_user_agent`
23-
// so fallback to checking if the `Bun` global is present
24-
// https://github.com/oven-sh/bun/issues/2530
25-
const isBun = 'Bun' in globalThis;
26-
27-
const packageManager = isBun
22+
const packageManager = /bun/.test(userAgent)
2823
? 'bun'
2924
: /pnpm/.test(userAgent)
3025
? 'pnpm'

0 commit comments

Comments
 (0)