Skip to content

Commit defd4e3

Browse files
FL4TLiN3claude
andauthored
chore: migrate toolchain to Bun (#599)
* chore: migrate toolchain from pnpm/Node.js/tsdown/vitest to Bun Unify the entire toolchain under Bun: package manager, runtime, test runner, script runner, and build system. Turborepo is retained for build orchestration and caching. **Package manager (pnpm → bun)** - Replace pnpm with bun workspaces, delete pnpm-lock.yaml/pnpm-workspace.yaml - Generate bun.lock, update all scripts from pnpm to bun **Runtime (Node.js → Bun)** - Change shebangs from #!/usr/bin/env node to #!/usr/bin/env bun - Update engines field to bun >= 1.2.0 across all packages **Build system (tsdown → tsc)** - Replace tsdown with tsc -p tsconfig.build.json for all 23 packages - Create per-package tsconfig.build.json with appropriate templates - Delete all tsdown config files **Test runner (vitest → bun:test)** - Migrate all 117 test files from vitest to bun:test API - Handle bun:test limitations: mock.module() cross-file leaking via per-package process isolation (turbo run test) and per-file isolation for @perstack/runtime - Create types/bun-test.d.ts for TypeScript support - Set up happy-dom for React component tests **Script runner (tsx → bun)** - Replace tsx with bun for validation scripts **CI/CD** - Update all GitHub Actions workflows to use oven-sh/setup-bun - Keep Node.js setup in release workflow for npm registry publishing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(ci): use turbo for test isolation and fix knip config - CI test step: use `bun run test` (turbo) instead of `bun test` directly to get per-package process isolation (prevents mock.module leaks) - knip: add entry points for create-expert-skill and runtime test files (previously discovered via tsdown/vitest plugins) - Remove unused smol-toml from root devDependencies (was used in deleted vitest.config.ts) - Add empty changeset Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(knip): add explicit entry points for create-expert apps CI knip may not auto-discover entries from package.json bin/exports fields. Add explicit entries to ensure consistent behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(knip): mark public API export and fix entry discovery - Mark collectToolDefinitionsForExpert as @public (part of runtime's public API, documented in README, but not imported internally) - Previously the vitest plugin traced this through test files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unnecessary bunfig.toml files - Root bunfig.toml: only had coverageSkipTestFiles, but CI doesn't use --coverage - packages/react/bunfig.toml: happydom preload is redundant since hook test files already import happydom directly Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused bun-test.d.ts type declarations Test files are excluded from tsconfig.json in all packages, so tsc never resolves bun:test imports. The type declarations are unnecessary. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent faa66cc commit defd4e3

File tree

216 files changed

+2548
-7790
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+2548
-7790
lines changed

.changeset/wide-words-unite.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.github/workflows/ci.yml

Lines changed: 50 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ permissions:
1515

1616
env:
1717
CI: "true"
18-
PNPM_VERSION: "10.10.0"
19-
NODE_VERSION: "22"
18+
BUN_VERSION: "latest"
2019

2120
jobs:
2221
lint:
@@ -26,22 +25,16 @@ jobs:
2625
steps:
2726
- uses: actions/checkout@v6
2827

29-
- name: Setup pnpm
30-
uses: pnpm/action-setup@v4
28+
- name: Setup Bun
29+
uses: oven-sh/setup-bun@v2
3130
with:
32-
version: ${{ env.PNPM_VERSION }}
33-
34-
- name: Setup Node.js
35-
uses: actions/setup-node@v6
36-
with:
37-
node-version: ${{ env.NODE_VERSION }}
38-
cache: "pnpm"
31+
bun-version: ${{ env.BUN_VERSION }}
3932

4033
- name: Install dependencies
41-
run: pnpm install --frozen-lockfile
34+
run: bun install --frozen-lockfile
4235

4336
- name: Lint & Format check
44-
run: pnpm run format-and-lint
37+
run: bun run format-and-lint
4538

4639
typecheck:
4740
name: Type Check
@@ -50,30 +43,24 @@ jobs:
5043
steps:
5144
- uses: actions/checkout@v6
5245

53-
- name: Setup pnpm
54-
uses: pnpm/action-setup@v4
46+
- name: Setup Bun
47+
uses: oven-sh/setup-bun@v2
5548
with:
56-
version: ${{ env.PNPM_VERSION }}
57-
58-
- name: Setup Node.js
59-
uses: actions/setup-node@v6
60-
with:
61-
node-version: ${{ env.NODE_VERSION }}
62-
cache: "pnpm"
49+
bun-version: ${{ env.BUN_VERSION }}
6350

6451
- name: Install dependencies
65-
run: pnpm install --frozen-lockfile
52+
run: bun install --frozen-lockfile
6653

6754
- name: Restore turbo cache
6855
uses: actions/cache@v5
6956
with:
7057
path: .turbo
71-
key: turbo-typecheck-${{ runner.os }}-${{ hashFiles('**/*.[tj]s', '**/*.[tj]sx', 'pnpm-lock.yaml') }}
58+
key: turbo-typecheck-${{ runner.os }}-${{ hashFiles('**/*.[tj]s', '**/*.[tj]sx', 'bun.lock') }}
7259
restore-keys: |
7360
turbo-typecheck-${{ runner.os }}-
7461
7562
- name: Type check
76-
run: pnpm run typecheck
63+
run: bun run typecheck
7764

7865
check-deps:
7966
name: Check Dependencies
@@ -82,22 +69,16 @@ jobs:
8269
steps:
8370
- uses: actions/checkout@v6
8471

85-
- name: Setup pnpm
86-
uses: pnpm/action-setup@v4
87-
with:
88-
version: ${{ env.PNPM_VERSION }}
89-
90-
- name: Setup Node.js
91-
uses: actions/setup-node@v6
72+
- name: Setup Bun
73+
uses: oven-sh/setup-bun@v2
9274
with:
93-
node-version: ${{ env.NODE_VERSION }}
94-
cache: "pnpm"
75+
bun-version: ${{ env.BUN_VERSION }}
9576

9677
- name: Install dependencies
97-
run: pnpm install --frozen-lockfile
78+
run: bun install --frozen-lockfile
9879

9980
- name: Check unused dependencies
100-
run: pnpm run check-deps
81+
run: bun run check-deps
10182

10283
validate-versions:
10384
name: Validate Versions
@@ -106,22 +87,16 @@ jobs:
10687
steps:
10788
- uses: actions/checkout@v6
10889

109-
- name: Setup pnpm
110-
uses: pnpm/action-setup@v4
111-
with:
112-
version: ${{ env.PNPM_VERSION }}
113-
114-
- name: Setup Node.js
115-
uses: actions/setup-node@v6
90+
- name: Setup Bun
91+
uses: oven-sh/setup-bun@v2
11692
with:
117-
node-version: ${{ env.NODE_VERSION }}
118-
cache: "pnpm"
93+
bun-version: ${{ env.BUN_VERSION }}
11994

12095
- name: Install dependencies
121-
run: pnpm install --frozen-lockfile
96+
run: bun install --frozen-lockfile
12297

12398
- name: Validate version sync
124-
run: pnpm run validate:versions
99+
run: bun run validate:versions
125100

126101
validate-changeset:
127102
name: Validate Changeset
@@ -130,22 +105,16 @@ jobs:
130105
steps:
131106
- uses: actions/checkout@v6
132107

133-
- name: Setup pnpm
134-
uses: pnpm/action-setup@v4
135-
with:
136-
version: ${{ env.PNPM_VERSION }}
137-
138-
- name: Setup Node.js
139-
uses: actions/setup-node@v6
108+
- name: Setup Bun
109+
uses: oven-sh/setup-bun@v2
140110
with:
141-
node-version: ${{ env.NODE_VERSION }}
142-
cache: "pnpm"
111+
bun-version: ${{ env.BUN_VERSION }}
143112

144113
- name: Install dependencies
145-
run: pnpm install --frozen-lockfile
114+
run: bun install --frozen-lockfile
146115

147116
- name: Validate changesets
148-
run: pnpm run validate:changeset
117+
run: bun run validate:changeset
149118

150119
check-schema-diff:
151120
name: Check Schema Diff
@@ -154,22 +123,16 @@ jobs:
154123
steps:
155124
- uses: actions/checkout@v6
156125

157-
- name: Setup pnpm
158-
uses: pnpm/action-setup@v4
126+
- name: Setup Bun
127+
uses: oven-sh/setup-bun@v2
159128
with:
160-
version: ${{ env.PNPM_VERSION }}
161-
162-
- name: Setup Node.js
163-
uses: actions/setup-node@v6
164-
with:
165-
node-version: ${{ env.NODE_VERSION }}
166-
cache: "pnpm"
129+
bun-version: ${{ env.BUN_VERSION }}
167130

168131
- name: Install dependencies
169-
run: pnpm install --frozen-lockfile
132+
run: bun install --frozen-lockfile
170133

171134
- name: Check schema diff
172-
run: pnpm run check:schema-diff
135+
run: bun run check:schema-diff
173136

174137
test:
175138
name: Test
@@ -178,25 +141,19 @@ jobs:
178141
steps:
179142
- uses: actions/checkout@v6
180143

181-
- name: Setup pnpm
182-
uses: pnpm/action-setup@v4
144+
- name: Setup Bun
145+
uses: oven-sh/setup-bun@v2
183146
with:
184-
version: ${{ env.PNPM_VERSION }}
185-
186-
- name: Setup Node.js
187-
uses: actions/setup-node@v6
188-
with:
189-
node-version: ${{ env.NODE_VERSION }}
190-
cache: "pnpm"
147+
bun-version: ${{ env.BUN_VERSION }}
191148

192149
- name: Install dependencies
193-
run: pnpm install --frozen-lockfile
150+
run: bun install --frozen-lockfile
194151

195152
- name: Prepare test environment
196-
run: pnpm run reset
153+
run: bun run reset
197154

198-
- name: Run tests with coverage
199-
run: pnpm test
155+
- name: Run tests
156+
run: bun run test
200157

201158
build:
202159
name: Build
@@ -207,30 +164,24 @@ jobs:
207164
with:
208165
fetch-depth: 0
209166

210-
- name: Setup pnpm
211-
uses: pnpm/action-setup@v4
167+
- name: Setup Bun
168+
uses: oven-sh/setup-bun@v2
212169
with:
213-
version: ${{ env.PNPM_VERSION }}
214-
215-
- name: Setup Node.js
216-
uses: actions/setup-node@v6
217-
with:
218-
node-version: ${{ env.NODE_VERSION }}
219-
cache: "pnpm"
170+
bun-version: ${{ env.BUN_VERSION }}
220171

221172
- name: Install dependencies
222-
run: pnpm install --frozen-lockfile
173+
run: bun install --frozen-lockfile
223174

224175
- name: Restore turbo cache
225176
uses: actions/cache@v5
226177
with:
227178
path: .turbo
228-
key: turbo-${{ runner.os }}-${{ hashFiles('**/*.[tj]s', '**/*.[tj]sx', 'pnpm-lock.yaml') }}
179+
key: turbo-${{ runner.os }}-${{ hashFiles('**/*.[tj]s', '**/*.[tj]sx', 'bun.lock') }}
229180
restore-keys: |
230181
turbo-${{ runner.os }}-
231182
232183
- name: Build all packages
233-
run: pnpm run build
184+
run: bun run build
234185
env:
235186
NODE_ENV: production
236187

@@ -255,23 +206,16 @@ jobs:
255206
echo "needs_changeset=true" >> "$GITHUB_OUTPUT"
256207
fi
257208
258-
- name: Setup pnpm
259-
if: steps.check_files.outputs.needs_changeset == 'true'
260-
uses: pnpm/action-setup@v4
261-
with:
262-
version: ${{ env.PNPM_VERSION }}
263-
264-
- name: Setup Node.js
209+
- name: Setup Bun
265210
if: steps.check_files.outputs.needs_changeset == 'true'
266-
uses: actions/setup-node@v6
211+
uses: oven-sh/setup-bun@v2
267212
with:
268-
node-version: ${{ env.NODE_VERSION }}
269-
cache: "pnpm"
213+
bun-version: ${{ env.BUN_VERSION }}
270214

271215
- name: Install dependencies
272216
if: steps.check_files.outputs.needs_changeset == 'true'
273-
run: pnpm install --frozen-lockfile
217+
run: bun install --frozen-lockfile
274218

275219
- name: Check changeset
276220
if: steps.check_files.outputs.needs_changeset == 'true'
277-
run: pnpm changeset status --since=origin/main
221+
run: bunx changeset status --since=origin/main

.github/workflows/e2e.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ concurrency:
1212
cancel-in-progress: false
1313

1414
env:
15-
PNPM_VERSION: '10.10.0'
16-
NODE_VERSION: '22'
15+
BUN_VERSION: 'latest'
1716

1817
jobs:
1918
e2e:
@@ -54,25 +53,19 @@ jobs:
5453
- name: Checkout
5554
uses: actions/checkout@v6
5655

57-
- name: Setup pnpm
58-
uses: pnpm/action-setup@v4
56+
- name: Setup Bun
57+
uses: oven-sh/setup-bun@v2
5958
with:
60-
version: ${{ env.PNPM_VERSION }}
61-
62-
- name: Setup Node.js
63-
uses: actions/setup-node@v6
64-
with:
65-
node-version: ${{ env.NODE_VERSION }}
66-
cache: 'pnpm'
59+
bun-version: ${{ env.BUN_VERSION }}
6760

6861
- name: Install dependencies
69-
run: pnpm install --frozen-lockfile
62+
run: bun install --frozen-lockfile
7063

7164
- name: Build
72-
run: pnpm run build
65+
run: bun run build
7366

7467
- name: Run E2E tests
75-
run: pnpm vitest run --project e2e ${{ matrix.files }}
68+
run: bun test --timeout 300000 ${{ matrix.files }}
7669
env:
7770
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
7871
EXA_API_KEY: ${{ secrets.EXA_API_KEY }}

.github/workflows/release.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414
id-token: write
1515

1616
env:
17-
PNPM_VERSION: '10.10.0'
17+
BUN_VERSION: 'latest'
1818
NODE_VERSION: '22'
1919

2020
jobs:
@@ -27,27 +27,26 @@ jobs:
2727
with:
2828
token: ${{ secrets.PAT_GITHUB_TOKEN }}
2929

30-
- name: Setup pnpm
31-
uses: pnpm/action-setup@v4
30+
- name: Setup Bun
31+
uses: oven-sh/setup-bun@v2
3232
with:
33-
version: ${{ env.PNPM_VERSION }}
33+
bun-version: ${{ env.BUN_VERSION }}
3434

3535
- name: Setup Node.js
3636
uses: actions/setup-node@v6
3737
with:
3838
node-version: ${{ env.NODE_VERSION }}
39-
cache: 'pnpm'
4039
registry-url: 'https://registry.npmjs.org'
4140

4241
- name: Install dependencies
43-
run: pnpm install --frozen-lockfile
42+
run: bun install --frozen-lockfile
4443

4544
- name: Create Release PR or Publish
4645
id: changesets
4746
uses: changesets/action@v1
4847
with:
49-
version: pnpm run version
50-
publish: pnpm run release
48+
version: bun run version
49+
publish: bun run release
5150
title: 'chore: version packages'
5251
commit: 'chore: version packages'
5352
env:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.bun
12
.claude/
23
.cursor/
34
.DS_Store

0 commit comments

Comments
 (0)