Skip to content

Commit cfcad1b

Browse files
Merge pull request #2262 from CapSoftware/improve/bun-1-4-migration
chore: migrate Cap tooling to Bun 1.4
2 parents 26dae87 + dd1ae52 commit cfcad1b

99 files changed

Lines changed: 9587 additions & 36720 deletions

File tree

Some content is hidden

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

.claude/agents/coderabbit-pr-reviewer.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ After implementing all fixes:
7070

7171
1. **Format Code**
7272
- Rust: `cargo fmt --all`
73-
- TypeScript: `pnpm format`
73+
- TypeScript: `bun run format`
7474

7575
2. **Check Compilation**
7676
- Rust: `cargo check -p affected_crate`
77-
- TypeScript: `pnpm typecheck`
77+
- TypeScript: `bun run typecheck`
7878

7979
3. **Lint Check**
8080
- Rust: `cargo clippy`
81-
- TypeScript: `pnpm lint`
81+
- TypeScript: `bun run lint`
8282

8383
## Critical Rules
8484

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,42 @@
1-
name: Setup JS (pnpm & node)
2-
description: Sets up pnpm & node with dependencies and caching
1+
name: Setup JS (Bun & Node)
2+
description: Sets up Bun 1.4.0 and Node with frozen dependencies and caching
33
runs:
44
using: "composite"
55
steps:
6-
- name: Install pnpm
7-
uses: pnpm/action-setup@v6
8-
with:
9-
run_install: false
10-
11-
- name: Setup node
6+
- name: Setup Node
127
uses: actions/setup-node@v4
138
with:
149
node-version: 20
15-
cache: pnpm
10+
11+
- name: Setup Bun
12+
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
13+
with:
14+
bun-version: 1.4.0
15+
16+
- name: Cache Bun packages
17+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
18+
with:
19+
path: ${{ runner.temp }}/bun-cache
20+
key: ${{ runner.os }}-${{ runner.arch }}-bun-1.4.0-${{ hashFiles('bun.lock') }}
21+
restore-keys: |
22+
${{ runner.os }}-${{ runner.arch }}-bun-1.4.0-
1623
1724
- name: Install frontend dependencies
1825
shell: bash
26+
env:
27+
BUN_INSTALL_CACHE_DIR: ${{ runner.temp }}/bun-cache
1928
run: |
2029
set -euo pipefail
2130
for attempt in 1 2 3; do
22-
if pnpm install; then
31+
if bun install --frozen-lockfile; then
2332
exit 0
2433
fi
2534
if [[ "$attempt" == "3" ]]; then
2635
exit 1
2736
fi
2837
sleep $((attempt * 30))
2938
done
39+
40+
- name: Verify Bun installation
41+
shell: bash
42+
run: bun run check:bun

.github/workflows/ci.yml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
desktop:
3535
- '.gitattributes'
3636
- '.github/actions/install-desktop-deps/**'
37+
- '.github/actions/setup-js/**'
3738
- '.github/workflows/ci.yml'
3839
- 'apps/cli/**'
3940
- 'apps/desktop/**'
@@ -52,7 +53,9 @@ jobs:
5253
- 'scripts/verify-gpui-release-inputs.mjs'
5354
- 'Cargo.toml'
5455
- 'Cargo.lock'
55-
- 'pnpm-lock.yaml'
56+
- 'bun.lock'
57+
- 'bunfig.toml'
58+
- 'package.json'
5659
rust:
5760
- '.cargo/**'
5861
- '.github/**'
@@ -64,7 +67,9 @@ jobs:
6467
- 'Cargo.lock'
6568
tauri-plugins:
6669
- 'Cargo.lock'
67-
- 'pnpm-lock.yaml'
70+
- 'bun.lock'
71+
- 'scripts/check-tauri-plugin-versions*'
72+
- 'apps/desktop/package.json'
6873
6974
- name: Output branch name
7075
id: branch
@@ -80,10 +85,25 @@ jobs:
8085

8186
- uses: ./.github/actions/setup-js
8287

83-
- run: pnpm web exec next typegen
88+
- run: bun run --cwd apps/web next typegen
89+
90+
- name: Test workspace tooling
91+
run: node --test scripts/bun-scripts.test.mjs scripts/check-tauri-plugin-versions.test.mjs
92+
93+
- name: Test web React compatibility
94+
run: >-
95+
bun run --cwd apps/web test
96+
__tests__/unit/embed-video-playback-chrome.test.ts
97+
__tests__/unit/homepage-demo-accessibility.test.ts
98+
__tests__/unit/linkified-text.test.ts
99+
__tests__/unit/loom-import-ui.test.ts
100+
__tests__/unit/media-player-store-refs.test.ts
101+
__tests__/unit/signed-baa-card.test.ts
102+
__tests__/unit/summary-editor.test.ts
103+
__tests__/unit/sso-login-pages.test.ts
84104
85105
- name: Typecheck
86-
run: pnpm typecheck
106+
run: bun run typecheck
87107

88108
mobile:
89109
name: Mobile
@@ -97,19 +117,19 @@ jobs:
97117
- name: Check Expo dependencies
98118
env:
99119
EXPO_OFFLINE: "1"
100-
run: pnpm --dir apps/mobile exec expo install --check
120+
run: bun run --cwd apps/mobile expo install --check
101121

102122
- name: Run Expo Doctor
103123
env:
104124
EXPO_OFFLINE: "1"
105125
working-directory: apps/mobile
106-
run: pnpm dlx expo-doctor@1.20.1
126+
run: bunx expo-doctor@1.20.1
107127

108128
- name: Typecheck
109-
run: pnpm --dir apps/mobile typecheck
129+
run: bun run --cwd apps/mobile typecheck
110130

111131
- name: Test
112-
run: pnpm --dir apps/mobile test
132+
run: bun run --cwd apps/mobile test
113133

114134
format-biome:
115135
name: Format (Biome)
@@ -271,7 +291,7 @@ jobs:
271291

272292
- name: Run cap-setup
273293
shell: bash
274-
run: pnpm -w cap-setup
294+
run: bun run cap-setup
275295
env:
276296
RUST_TARGET_TRIPLE: ${{ matrix.settings.target }}
277297

@@ -284,7 +304,7 @@ jobs:
284304
shell: bash
285305
run: |
286306
node --test scripts/linux-bundle-config.test.mjs scripts/finalize-linux-appimage.test.mjs
287-
pnpm --dir apps/desktop exec vitest run scripts/prepare.test.js
307+
bun run --cwd apps/desktop vitest run scripts/prepare.test.js
288308
cargo test --locked -p cap-utils -p cap-cli-install --lib
289309
cargo test --locked -p cap --bin cap record::tests
290310
cargo test --locked -p cap-recording --lib -- --test-threads=1
@@ -317,7 +337,7 @@ jobs:
317337
318338
- name: Build app
319339
working-directory: apps/desktop
320-
run: pnpm tauri build --debug --target ${{ matrix.settings.target }} --no-bundle
340+
run: bun run tauri build --debug --target ${{ matrix.settings.target }} --no-bundle
321341
env:
322342
LD_LIBRARY_PATH: ${{ runner.os == 'Linux' && format('{0}/target/native-deps/lib:{0}/target/debug:{0}/target/{1}/debug', github.workspace, matrix.settings.target) || '' }}
323343
RUST_TARGET_TRIPLE: ${{ matrix.settings.target }}
@@ -331,10 +351,7 @@ jobs:
331351
- name: Checkout
332352
uses: actions/checkout@v4
333353

334-
- name: Setup node
335-
uses: actions/setup-node@v3
336-
with:
337-
node-version: 20
354+
- uses: ./.github/actions/setup-js
338355

339356
- name: Run verify
340357
shell: bash

.github/workflows/desktop-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ jobs:
301301
302302
- name: Run cap-setup
303303
shell: bash
304-
run: pnpm -w cap-setup
304+
run: bun run cap-setup
305305
env:
306306
RUST_TARGET_TRIPLE: ${{ matrix.settings.target }}
307307
APPLE_SIGNING_IDENTITY: ${{ runner.os == 'macOS' && secrets.APPLE_SIGNING_IDENTITY || '' }}
@@ -348,7 +348,7 @@ jobs:
348348

349349
- name: Build app
350350
working-directory: apps/desktop
351-
run: ${{ runner.os == 'Linux' && 'CARGO_PROFILE_RELEASE_DEBUG=0 node ../../scripts/build-linux-packages.mjs' || runner.os == 'macOS' && hashFiles('scripts/build-macos-packages.mjs') != '' && 'node ../../scripts/build-macos-packages.mjs' || 'pnpm build:tauri --target' }} ${{ matrix.settings.target }} --config src-tauri/tauri.prod.conf.json ${{ runner.os == 'Windows' && '--bundles nsis' || runner.os == 'Linux' && '--verbose' || '' }}
351+
run: ${{ runner.os == 'Linux' && 'CARGO_PROFILE_RELEASE_DEBUG=0 node ../../scripts/build-linux-packages.mjs' || runner.os == 'macOS' && hashFiles('scripts/build-macos-packages.mjs') != '' && 'node ../../scripts/build-macos-packages.mjs' || 'bun run build:tauri --target' }} ${{ matrix.settings.target }} --config src-tauri/tauri.prod.conf.json ${{ runner.os == 'Windows' && '--bundles nsis' || runner.os == 'Linux' && '--verbose' || '' }}
352352
env:
353353
# https://github.com/tauri-apps/tauri-action/issues/740
354354
CI: false
@@ -411,7 +411,7 @@ jobs:
411411
if: ${{ runner.os == 'Windows' }}
412412
working-directory: apps/desktop
413413
shell: bash
414-
run: pnpm tauri bundle --target ${{ matrix.settings.target }} --bundles nsis --config src-tauri/tauri.prod.conf.json
414+
run: bun run tauri bundle --target ${{ matrix.settings.target }} --bundles nsis --config src-tauri/tauri.prod.conf.json
415415
env:
416416
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
417417
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
@@ -792,7 +792,7 @@ jobs:
792792
for exe in "$BUNDLE_DIR"/*.exe; do
793793
echo "Re-signing $(basename "$exe") for Tauri updater..."
794794
rm -f "${exe}.sig"
795-
pnpm tauri signer sign -k "$TAURI_SIGNING_PRIVATE_KEY" -p "$TAURI_SIGNING_PRIVATE_KEY_PASSWORD" "$exe"
795+
bun run tauri signer sign -k "$TAURI_SIGNING_PRIVATE_KEY" -p "$TAURI_SIGNING_PRIVATE_KEY_PASSWORD" "$exe"
796796
if [[ ! -s "${exe}.sig" ]]; then
797797
echo "::error::Windows production updater signature missing for $exe"
798798
exit 1

.github/workflows/publish-chrome-extension.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,21 @@ jobs:
6767
done
6868
6969
- name: Typecheck
70-
run: pnpm --filter "@cap/chrome-extension..." typecheck
70+
run: bun run --filter "@cap/chrome-extension..." typecheck
7171

7272
- name: Test
73-
run: pnpm --filter @cap/chrome-extension test
73+
run: bun run --filter @cap/chrome-extension test
7474

7575
- name: Install Playwright browser
7676
if: ${{ inputs.run_e2e }}
77-
run: pnpm --filter @cap/chrome-extension test:e2e:install
77+
run: bun run --filter @cap/chrome-extension test:e2e:install
7878

7979
- name: Test E2E
8080
if: ${{ inputs.run_e2e }}
81-
run: pnpm --filter @cap/chrome-extension test:e2e
81+
run: bun run --filter @cap/chrome-extension test:e2e
8282

8383
- name: Build
84-
run: pnpm --filter @cap/chrome-extension build
84+
run: bun run --filter @cap/chrome-extension build
8585

8686
- name: Package
8787
id: package

.github/workflows/recording-reliability.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- "packages/database/**"
1010
- "packages/web-*/**"
1111
- "crates/recording/**"
12-
- "pnpm-lock.yaml"
12+
- "bun.lock"
1313
- ".github/workflows/recording-reliability.yml"
1414
push:
1515
branches: [main]
@@ -19,7 +19,7 @@ on:
1919
- "packages/database/**"
2020
- "packages/web-*/**"
2121
- "crates/recording/**"
22-
- "pnpm-lock.yaml"
22+
- "bun.lock"
2323
- ".github/workflows/recording-reliability.yml"
2424

2525
permissions:
@@ -40,7 +40,7 @@ jobs:
4040
- name: Verify recording contracts
4141
working-directory: apps/web
4242
run: |
43-
pnpm exec vitest run \
43+
bun run vitest run \
4444
__tests__/unit/audio-level-publication.test.ts \
4545
__tests__/unit/recording-output.test.ts \
4646
__tests__/unit/recording-storage-lifecycle.test.ts \

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ logs
44
npm-debug.log*
55
yarn-debug.log*
66
yarn-error.log*
7-
pnpm-debug.log*
87
lerna-debug.log*
98
.deepsec
109

@@ -36,13 +35,10 @@ outputs
3635
*.sln
3736
*.sw?
3837
.turbo
39-
bun.lock
40-
pnpm-lock.yaml
4138
.zed
4239
.output
4340
.vinxi
4441
native-deps*
45-
apps/storybook/storybook-static
4642
.tinyb
4743

4844
**/.tinyb

.npmrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

AGENTS.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ These rules are enforced by CI (`cargo clippy -D warnings`, Biome). Fixing them
66

77
### Zero-tolerance rules
88
- **Default to no code comments. Add a comment only after solving a bug or working through a complex issue, and only when it captures non-obvious context that a future investigator or reviewer genuinely needs** — e.g. why the fix looks the way it does, the upstream/platform bug being worked around, a non-obvious invariant or trade-off chosen after investigation, or a link to the PR/issue that explains the decision. Bad cases that remain banned: narrating what the code does, restating types, JSDoc that paraphrases parameter names, "TODO: refactor" or "this should be cleaner" notes, and any comment that just describes the change you are currently making. When in doubt, prefer better naming/types over a comment. Applies to every language: Rust, TS, JS, Python, shell, SQL, TOML, etc.
9-
- **Never hand-edit generated files**: `**/tauri.ts`, `apps/desktop/src-tauri/gen/**`, `packages/ui-solid/src/auto-imports.d.ts`, Drizzle migration SQL under `packages/database/migrations/`. These are regenerated (e.g. `tauri.ts` only on debug desktop runs) but stay committed because CI typecheck and fresh clones depend on them; commit binding changes alongside the Rust change that produced them. For database schema changes, run `pnpm db:generate` and commit the generated SQL, snapshot, and journal changes alongside the schema change. Generating and committing these artifacts is required; modifying generated output by hand is prohibited. Note: `apps/desktop/src/utils/queries.ts` is hand-written, not generated — edit it normally.
10-
- **Never start additional dev servers** (`pnpm dev`, `pnpm dev:web`, `pnpm dev:desktop`, Docker services). Assume they are already running.
9+
- **Never hand-edit generated files**: `**/tauri.ts`, `apps/desktop/src-tauri/gen/**`, `packages/ui-solid/src/auto-imports.d.ts`, Drizzle migration SQL under `packages/database/migrations/`. These are regenerated (e.g. `tauri.ts` only on debug desktop runs) but stay committed because CI typecheck and fresh clones depend on them; commit binding changes alongside the Rust change that produced them. For database schema changes, run `bun run db:generate` and commit the generated SQL, snapshot, and journal changes alongside the schema change. Generating and committing these artifacts is required; modifying generated output by hand is prohibited. Note: `apps/desktop/src/utils/queries.ts` is hand-written, not generated — edit it normally.
10+
- **Never start additional dev servers** (`bun run dev`, `bun run dev:web`, `bun run dev:desktop`, Docker services). Assume they are already running.
1111

1212
### Post-edit checks (run before you say "done")
1313
- Prefer scoped, fast checks over full workspace gates. Do not run long full-repo checks by default.
1414
- Touched any Rust file → `cargo fmt --all` and `cargo check -p <crate>`. Add `--all-targets`, `--workspace`, or clippy only when explicitly requested, when preparing CI/PR final validation, or when the change needs broader coverage.
15-
- Touched any TS / JS / JSON / CSS / MD file → run the narrowest applicable formatter/linter on touched files first, such as `pnpm exec biome check --write <files>`. Use full `pnpm format`, `pnpm lint`, and `pnpm typecheck` only when explicitly requested or when the change spans shared types/packages.
16-
- Touched DB schema → `pnpm db:generate` before relying on it.
15+
- Touched any TS / JS / JSON / CSS / MD file → run the narrowest applicable formatter/linter on touched files first, such as `bun run biome check --write <files>`. Use full `bun run format`, `bun run lint`, and `bun run typecheck` only when explicitly requested or when the change spans shared types/packages.
16+
- Touched DB schema → `bun run db:generate` before relying on it.
1717

1818
### Rust — write the clippy-clean form the FIRST time
1919
All patterns below are `deny` in the workspace `[workspace.lints]` in `Cargo.toml`. Do not emit the left column; always emit the right column.
@@ -56,18 +56,18 @@ Additionally, `unused_must_use = "deny"` applies to all Rust code: every `Result
5656
- `scripts/*`, `infra/`, and `packages/local-docker/` for tooling and local services.
5757

5858
## Build, Test, Develop
59-
- Install: `pnpm install`; setup: `pnpm env-setup` then `pnpm cap-setup`.
60-
- Dev: `pnpm dev` (web+desktop). Desktop only: `pnpm dev:desktop`. Web only: `pnpm dev:web` or `cd apps/web && pnpm dev`.
61-
- Build: `pnpm build` (Turbo). Desktop release: `pnpm tauri:build`.
62-
- DB: `pnpm db:generate``pnpm db:push``pnpm db:studio`.
63-
- Docker: `pnpm docker:up | docker:stop | docker:clean`.
64-
- Quality: `pnpm lint`, `pnpm format`, `pnpm typecheck`. Rust: `cargo build -p <crate>`, `cargo test -p <crate>`.
59+
- Install: `bun install`; setup: `bun run env-setup` then `bun run cap-setup`.
60+
- Dev: `bun run dev` (web+desktop). Desktop only: `bun run dev:desktop`. Web only: `bun run dev:web` or `cd apps/web && bun run dev`.
61+
- Build: `bun run build` (Turbo). Desktop release: `bun run tauri:build`.
62+
- DB: `bun run db:generate``bun run db:push``bun run db:studio`.
63+
- Docker: `bun run docker:up | docker:stop | docker:clean`.
64+
- Quality: `bun run lint`, `bun run format`, `bun run typecheck`. Rust: `cargo build -p <crate>`, `cargo test -p <crate>`.
6565

6666
## Coding Style & Naming
6767
- TypeScript / JS / JSON / CSS: **tab indent** and **double-quoted** strings, enforced by Biome (see `biome.json`). Do not configure per-file overrides.
6868
- Rust: `rustfmt` default style + the denied clippy lints in the Pre-Generation Invariants above.
6969
- Naming: files kebab‑case (`user-menu.tsx`); React/Solid components PascalCase; hooks `useX`; Rust modules snake_case; crates kebab‑case.
70-
- Runtime: Node 20, pnpm 10.5.2, Rust 1.88+, Docker for MySQL/MinIO.
70+
- Runtime: Node 20, Bun 1.4.0, Rust 1.88+, Docker for MySQL/MinIO.
7171

7272
(See **Pre-Generation Invariants** at the top of this file for the comments policy and the denied clippy/Biome patterns. Those are the source of truth — do not duplicate or weaken them here.)
7373

@@ -82,11 +82,11 @@ Additionally, `unused_must_use = "deny"` applies to all Rust code: every `Result
8282
- PRs: clear description, linked issues, screenshots/GIFs for UI, env/migration notes. Keep scope tight and update docs when behavior changes.
8383

8484
## Agent‑Specific Practices
85-
- Do not start extra servers; use `pnpm dev:web` or `pnpm dev:desktop` as needed.
85+
- Do not start extra servers; use `bun run dev:web` or `bun run dev:desktop` as needed.
8686
- Prefer existing scripts and Turbo filters over ad‑hoc commands; clear `.turbo` only when necessary.
8787
- Database flow: always `db:generate``db:push` before relying on new schema.
88-
- Keep secrets out of VCS; configure via `.env` from `pnpm env-setup`.
89-
- macOS note: desktop permissions (screen/mic) apply to the terminal running `pnpm dev:desktop`.
88+
- Keep secrets out of VCS; configure via `.env` from `bun run env-setup`.
89+
- macOS note: desktop permissions (screen/mic) apply to the terminal running `bun run dev:desktop`.
9090
- All other agent-facing rules (comments policy, no editing generated files, clippy/Biome shape, post-edit gates) live in **Pre-Generation Invariants** at the top of this file.
9191

9292
## Deep Investigation Default
@@ -112,5 +112,5 @@ Prefer the smallest correct fix, but only after checking whether the narrow fix
112112
Before declaring any task complete, the agent should run the fastest useful check for every file type it touched and report anything skipped.
113113

114114
- **Rust**: `cargo fmt --all` and `cargo check -p <crate>` for the touched crate. Add `--all-targets`, `--workspace`, or `cargo clippy -p <crate> --all-targets -- -D warnings` only for explicit requests, CI/PR final validation, or changes that need broader coverage.
115-
- **TS / JS / JSON / CSS / MD**: prefer scoped checks such as `pnpm exec biome check --write <files>`. Use full `pnpm format`, `pnpm lint`, and `pnpm typecheck` only when explicitly requested or when the change is broad enough to justify it.
115+
- **TS / JS / JSON / CSS / MD**: prefer scoped checks such as `bun run biome check --write <files>`. Use full `bun run format`, `bun run lint`, and `bun run typecheck` only when explicitly requested or when the change is broad enough to justify it.
116116
- If a scoped check fails, fix the violation in the source (do NOT suppress with `#[allow(...)]`, `// biome-ignore`, or `any` unless explicitly approved). The Pre-Generation Invariants show the correct form for every denied lint.

0 commit comments

Comments
 (0)