Skip to content

Commit ea8942e

Browse files
authored
chore: switch package manager from bun to pnpm (#967)
## Summary First step of the Bun → Node.js migration. Switches the project's package manager from bun to pnpm while keeping bun as the TS runner and test runner for now (incremental migration). ### Changes - Set `packageManager` to `pnpm@10.11.0` - Move `patchedDependencies` into `pnpm` config section (pnpm nests it under `"pnpm": {}`) - Add `onlyBuiltDependencies: ["esbuild"]` for pnpm's build script approval - Add `@sentry/core` and `@clack/prompts` as explicit `devDependencies` — these were phantom deps hoisted by bun's flat `node_modules` but imported directly by source code - Generate `pnpm-lock.yaml` ### Test results All 6968 unit tests pass under `bun test` with pnpm's `node_modules`. One pre-existing test fragility (`sdk.run throws when auth is required but missing` in `test/lib/index.test.ts`) surfaces under pnpm's strict hoisting — the mock fetch returns empty 200s which prevents the expected auth error. This is unrelated to this change and will be addressed separately. ### Notes - `bun.lock` is intentionally kept for now — will be removed in a cleanup PR after the full migration - All three patches (`@stricli/core`, `@sentry/core`, `@sentry/node-core`) apply successfully under pnpm - Scripts still use `bun run` / `bun test` internally — migrating those to `tsx` / `vitest` is a separate step
1 parent 419373c commit ea8942e

9 files changed

Lines changed: 4054 additions & 48 deletions

File tree

.github/workflows/ci.yml

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- 'docs/**'
6464
- 'plugins/**'
6565
- 'package.json'
66-
- 'bun.lock'
66+
- 'pnpm-lock.yaml'
6767
- '.github/workflows/ci.yml'
6868
- name: Compute build matrix
6969
id: targets
@@ -123,13 +123,16 @@ jobs:
123123
# merge SHA, always fetchable from the base repo with github.token).
124124
ref: ${{ steps.token.outcome == 'success' && (github.head_ref || github.ref_name) || '' }}
125125
- uses: oven-sh/setup-bun@v2
126+
with:
127+
bun-version: "1.3.13"
128+
- uses: pnpm/action-setup@v4
126129
- uses: actions/cache@v5
127130
id: cache
128131
with:
129132
path: node_modules
130-
key: node-modules-${{ hashFiles('bun.lock', 'patches/**') }}
133+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
131134
- if: steps.cache.outputs.cache-hit != 'true'
132-
run: bun install --frozen-lockfile
135+
run: pnpm install --frozen-lockfile
133136
- name: Generate API Schema
134137
run: bun run generate:schema
135138
- name: Generate docs and skill files
@@ -175,13 +178,16 @@ jobs:
175178
steps:
176179
- uses: actions/checkout@v6
177180
- uses: oven-sh/setup-bun@v2
181+
with:
182+
bun-version: "1.3.13"
183+
- uses: pnpm/action-setup@v4
178184
- uses: actions/cache@v5
179185
id: cache
180186
with:
181187
path: node_modules
182-
key: node-modules-${{ hashFiles('bun.lock', 'patches/**') }}
188+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
183189
- if: steps.cache.outputs.cache-hit != 'true'
184-
run: bun install --frozen-lockfile
190+
run: pnpm install --frozen-lockfile
185191
- run: bun run generate:schema
186192
- run: bun run lint
187193
- run: bun run typecheck
@@ -201,13 +207,16 @@ jobs:
201207
steps:
202208
- uses: actions/checkout@v6
203209
- uses: oven-sh/setup-bun@v2
210+
with:
211+
bun-version: "1.3.13"
212+
- uses: pnpm/action-setup@v4
204213
- uses: actions/cache@v5
205214
id: cache
206215
with:
207216
path: node_modules
208-
key: node-modules-${{ hashFiles('bun.lock', 'patches/**') }}
217+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
209218
- if: steps.cache.outputs.cache-hit != 'true'
210-
run: bun install --frozen-lockfile
219+
run: pnpm install --frozen-lockfile
211220
- name: Generate API Schema
212221
run: bun run generate:schema
213222
- name: Unit Tests
@@ -233,25 +242,18 @@ jobs:
233242
steps:
234243
- uses: actions/checkout@v6
235244
- uses: oven-sh/setup-bun@v2
245+
with:
246+
bun-version: "1.3.13"
247+
- uses: pnpm/action-setup@v4
236248
- uses: actions/cache@v5
237249
id: cache
238250
with:
239251
path: node_modules
240-
key: node-modules-${{ matrix.os }}-${{ hashFiles('bun.lock', 'patches/**') }}
252+
key: node-modules-${{ matrix.os }}-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
241253
- name: Install dependencies
242254
if: steps.cache.outputs.cache-hit != 'true'
243255
shell: bash
244-
run: |
245-
# Retry logic for Windows Bun patch bug (ENOTEMPTY errors)
246-
for i in 1 2 3; do
247-
if bun install --frozen-lockfile; then
248-
exit 0
249-
fi
250-
echo "Attempt $i failed, clearing Bun cache and retrying..."
251-
bun pm cache rm 2>/dev/null || true
252-
done
253-
echo "All install attempts failed"
254-
exit 1
256+
run: pnpm install --frozen-lockfile
255257
- name: Set nightly version
256258
# Inject the nightly version (computed once in the changes job) into
257259
# package.json before the build so it gets baked into the binary.
@@ -628,13 +630,16 @@ jobs:
628630
steps:
629631
- uses: actions/checkout@v6
630632
- uses: oven-sh/setup-bun@v2
633+
with:
634+
bun-version: "1.3.13"
635+
- uses: pnpm/action-setup@v4
631636
- uses: actions/cache@v5
632637
id: cache
633638
with:
634639
path: node_modules
635-
key: node-modules-${{ hashFiles('bun.lock', 'patches/**') }}
640+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
636641
- if: steps.cache.outputs.cache-hit != 'true'
637-
run: bun install --frozen-lockfile
642+
run: pnpm install --frozen-lockfile
638643
- name: Download Linux binary
639644
uses: actions/download-artifact@v8
640645
with:
@@ -664,16 +669,19 @@ jobs:
664669
steps:
665670
- uses: actions/checkout@v6
666671
- uses: oven-sh/setup-bun@v2
672+
with:
673+
bun-version: "1.3.13"
674+
- uses: pnpm/action-setup@v4
667675
- uses: actions/setup-node@v6
668676
with:
669677
node-version: ${{ matrix.node }}
670678
- uses: actions/cache@v5
671679
id: cache
672680
with:
673681
path: node_modules
674-
key: node-modules-${{ hashFiles('bun.lock', 'patches/**') }}
682+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
675683
- if: steps.cache.outputs.cache-hit != 'true'
676-
run: bun install --frozen-lockfile
684+
run: pnpm install --frozen-lockfile
677685
- name: Bundle
678686
env:
679687
# Environment-scoped (production) — see note in build-binary.
@@ -705,6 +713,9 @@ jobs:
705713
steps:
706714
- uses: actions/checkout@v6
707715
- uses: oven-sh/setup-bun@v2
716+
with:
717+
bun-version: "1.3.13"
718+
- uses: pnpm/action-setup@v4
708719
# Astro 6 requires Node >= 22.12. Pin an explicit version so the docs
709720
# build doesn't rely on whatever ships on the runner image.
710721
- uses: actions/setup-node@v6
@@ -714,9 +725,9 @@ jobs:
714725
id: cache
715726
with:
716727
path: node_modules
717-
key: node-modules-${{ hashFiles('bun.lock', 'patches/**') }}
728+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
718729
- if: steps.cache.outputs.cache-hit != 'true'
719-
run: bun install --frozen-lockfile
730+
run: pnpm install --frozen-lockfile
720731
- name: Get CLI version
721732
id: version
722733
run: echo "version=$(node -p 'require("./package.json").version')" >> "$GITHUB_OUTPUT"

.github/workflows/docs-preview.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
- uses: actions/checkout@v6
3535

3636
- uses: oven-sh/setup-bun@v2
37+
with:
38+
bun-version: "1.3.13"
39+
- uses: pnpm/action-setup@v4
3740

3841
# Astro 6 requires Node >= 22.12. Pin an explicit version so the docs
3942
# build doesn't rely on whatever ships on the runner image.
@@ -45,10 +48,10 @@ jobs:
4548
id: cache
4649
with:
4750
path: node_modules
48-
key: node-modules-${{ hashFiles('bun.lock', 'patches/**') }}
51+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
4952

5053
- if: steps.cache.outputs.cache-hit != 'true'
51-
run: bun install --frozen-lockfile
54+
run: pnpm install --frozen-lockfile
5255

5356
- name: Get CLI version
5457
id: version

.github/workflows/eval-skill-fork.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,17 @@ jobs:
3737
ref: ${{ github.event.pull_request.head.sha }}
3838

3939
- uses: oven-sh/setup-bun@v2
40+
with:
41+
bun-version: "1.3.13"
42+
- uses: pnpm/action-setup@v4
4043

4144
- uses: actions/cache@v5
4245
id: cache
4346
with:
4447
path: node_modules
45-
key: node-modules-${{ hashFiles('bun.lock', 'patches/**') }}
48+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
4649
- if: steps.cache.outputs.cache-hit != 'true'
47-
run: bun install --frozen-lockfile
50+
run: pnpm install --frozen-lockfile
4851

4952
- name: Generate docs and skill files
5053
run: bun run generate:schema && bun run generate:docs

0 commit comments

Comments
 (0)