From a404460413fb7c0c2182e935bb373ba51904df70 Mon Sep 17 00:00:00 2001 From: CaIon Date: Fri, 23 Oct 2026 21:08:54 +0800 Subject: [PATCH] chore(web): upgrade Bun to 1.4.4 and use bun check --- .github/workflows/ci.yml | 4 ++-- .github/workflows/electron-build.yml | 2 +- .github/workflows/release.yml | 6 +++--- Dockerfile | 2 +- README.en.md | 2 +- README.fr.md | 2 +- README.ja.md | 2 +- README.md | 2 +- README.zh_CN.md | 2 +- README.zh_TW.md | 2 +- THIRD-PARTY-LICENSES.md | 1 - web/AGENTS.md | 6 +++--- web/bun.lock | 17 ----------------- web/package.json | 8 ++++---- 14 files changed, 20 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c20540c07a..09257667a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,13 +87,13 @@ jobs: - name: Set up Bun uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: - bun-version: '1.4.0' + bun-version: '1.4.4' - name: Install dependencies run: bun install --frozen-lockfile - name: Typecheck - run: bun run typecheck + run: bun check -b - name: Test run: bun run test diff --git a/.github/workflows/electron-build.yml b/.github/workflows/electron-build.yml index f5f42f48c2..99d7f18d45 100644 --- a/.github/workflows/electron-build.yml +++ b/.github/workflows/electron-build.yml @@ -29,7 +29,7 @@ jobs: - name: Setup Bun uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: - bun-version: '1.4.0' + bun-version: '1.4.4' - name: Setup Node.js uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e447ad7f8..e524dc3a5c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: echo "VERSION=$VERSION" >> "$GITHUB_ENV" - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: - bun-version: '1.4.0' + bun-version: '1.4.4' - name: Build Frontend env: CI: "" @@ -85,7 +85,7 @@ jobs: echo "VERSION=$VERSION" >> "$GITHUB_ENV" - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: - bun-version: '1.4.0' + bun-version: '1.4.4' - name: Build Frontend env: CI: "" @@ -137,7 +137,7 @@ jobs: echo "VERSION=$VERSION" >> "$GITHUB_ENV" - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: - bun-version: '1.4.0' + bun-version: '1.4.4' - name: Build Frontend env: CI: "" diff --git a/Dockerfile b/Dockerfile index 1373c28e4c..3a2bc74db7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM oven/bun:1.4.0@sha256:5ff609364c049b54eb0ff560ec96319729a972078ef2c755d758f0c6ef89c2d6 AS builder +FROM oven/bun:1.4.4@sha256:1d22548f177f4ff38e0c15baa3c2c46c6c2060ba2d1bc573bb4720b407548f1d AS builder WORKDIR /build/web COPY web/package.json web/bun.lock ./ diff --git a/README.en.md b/README.en.md index 58b5815010..6174e6e05f 100644 --- a/README.en.md +++ b/README.en.md @@ -286,7 +286,7 @@ Open [http://localhost:5173](http://localhost:5173); the development server prox | `web/` | Web console; see [frontend conventions](./web/AGENTS.md) | | [electron/](./electron/README.md) | Desktop wrapper and packaging | -Read [AGENTS.md](./AGENTS.md) before contributing. Run checks appropriate to your change, including `make test` for the Go modules and `bun run typecheck`, `bun run lint`, `bun run test`, and `bun run build` in `web/` for frontend changes. Changes to RelayKit must also pass `GOWORK=off go build ./...` from `relaykit/`. +Read [AGENTS.md](./AGENTS.md) before contributing. Run checks appropriate to your change, including `make test` for the Go modules and `bun check -b`, `bun run lint`, `bun run test`, and `bun run build` in `web/` for frontend changes. Changes to RelayKit must also pass `GOWORK=off go build ./...` from `relaykit/`. diff --git a/README.fr.md b/README.fr.md index 583c6bccc0..429c87036e 100644 --- a/README.fr.md +++ b/README.fr.md @@ -267,7 +267,7 @@ Ouvrez [http://localhost:5173](http://localhost:5173) ; les requêtes API sont r | `web/` | Console web ; voir les [conventions frontend](./web/AGENTS.md) | | [electron/](./electron/README.md) | Application de bureau et packaging | -Lisez [AGENTS.md](./AGENTS.md) avant de contribuer. Exécutez les vérifications adaptées : `make test` pour les modules Go ; `bun run typecheck`, `bun run lint`, `bun run test` et `bun run build` dans `web/` pour le frontend. Une modification de RelayKit nécessite aussi `GOWORK=off go build ./...` depuis `relaykit/`. +Lisez [AGENTS.md](./AGENTS.md) avant de contribuer. Exécutez les vérifications adaptées : `make test` pour les modules Go ; `bun check -b`, `bun run lint`, `bun run test` et `bun run build` dans `web/` pour le frontend. Une modification de RelayKit nécessite aussi `GOWORK=off go build ./...` depuis `relaykit/`. diff --git a/README.ja.md b/README.ja.md index 738011ec31..f1e6135577 100644 --- a/README.ja.md +++ b/README.ja.md @@ -267,7 +267,7 @@ bun run dev -- --port 5173 | `web/` | Web 管理画面。[フロントエンドの規約](./web/AGENTS.md)を参照 | | [electron/](./electron/README.md) | デスクトップアプリのラッパーとパッケージング | -貢献前に [AGENTS.md](./AGENTS.md) を確認してください。変更に応じて、Go モジュールは `make test`、フロントエンドは `web/` で `bun run typecheck`、`bun run lint`、`bun run test`、`bun run build` を実行します。RelayKit を変更した場合は、`relaykit/` で `GOWORK=off go build ./...` も実行してください。 +貢献前に [AGENTS.md](./AGENTS.md) を確認してください。変更に応じて、Go モジュールは `make test`、フロントエンドは `web/` で `bun check -b`、`bun run lint`、`bun run test`、`bun run build` を実行します。RelayKit を変更した場合は、`relaykit/` で `GOWORK=off go build ./...` も実行してください。 diff --git a/README.md b/README.md index f79718fa68..82dbd61e17 100644 --- a/README.md +++ b/README.md @@ -282,7 +282,7 @@ Open [http://localhost:5173](http://localhost:5173); the development server prox | `web/` | Web console; see [frontend conventions](./web/AGENTS.md) | | [electron/](./electron/README.md) | Desktop wrapper and packaging | -Read [AGENTS.md](./AGENTS.md) before contributing. Run checks appropriate to your change, including `make test` for the Go modules and `bun run typecheck`, `bun run lint`, `bun run test`, and `bun run build` in `web/` for frontend changes. Changes to RelayKit must also pass `GOWORK=off go build ./...` from `relaykit/`. +Read [AGENTS.md](./AGENTS.md) before contributing. Run checks appropriate to your change, including `make test` for the Go modules and `bun check -b`, `bun run lint`, `bun run test`, and `bun run build` in `web/` for frontend changes. Changes to RelayKit must also pass `GOWORK=off go build ./...` from `relaykit/`. diff --git a/README.zh_CN.md b/README.zh_CN.md index 286417453b..d775a6d9a5 100644 --- a/README.zh_CN.md +++ b/README.zh_CN.md @@ -282,7 +282,7 @@ bun run dev -- --port 5173 | `web/` | Web 控制台,参阅[前端开发约定](./web/AGENTS.md) | | [electron/](./electron/README.md) | 桌面封装与打包 | -贡献前请阅读 [AGENTS.md](./AGENTS.md)。按改动范围执行检查:Go 模块使用 `make test`;前端在 `web/` 下运行 `bun run typecheck`、`bun run lint`、`bun run test` 和 `bun run build`。修改 RelayKit 后还必须在 `relaykit/` 下执行 `GOWORK=off go build ./...`。 +贡献前请阅读 [AGENTS.md](./AGENTS.md)。按改动范围执行检查:Go 模块使用 `make test`;前端在 `web/` 下运行 `bun check -b`、`bun run lint`、`bun run test` 和 `bun run build`。修改 RelayKit 后还必须在 `relaykit/` 下执行 `GOWORK=off go build ./...`。 diff --git a/README.zh_TW.md b/README.zh_TW.md index a7091dc4d7..8cd6b17c42 100644 --- a/README.zh_TW.md +++ b/README.zh_TW.md @@ -266,7 +266,7 @@ bun run dev -- --port 5173 | `web/` | Web 控制台,參閱[前端開發約定](./web/AGENTS.md) | | [electron/](./electron/README.md) | 桌面封裝與打包 | -貢獻前請閱讀 [AGENTS.md](./AGENTS.md)。依改動範圍執行檢查:Go 模組使用 `make test`;前端在 `web/` 下執行 `bun run typecheck`、`bun run lint`、`bun run test` 和 `bun run build`。修改 RelayKit 後還必須在 `relaykit/` 下執行 `GOWORK=off go build ./...`。 +貢獻前請閱讀 [AGENTS.md](./AGENTS.md)。依改動範圍執行檢查:Go 模組使用 `make test`;前端在 `web/` 下執行 `bun check -b`、`bun run lint`、`bun run test` 和 `bun run build`。修改 RelayKit 後還必須在 `relaykit/` 下執行 `GOWORK=off go build ./...`。 diff --git a/THIRD-PARTY-LICENSES.md b/THIRD-PARTY-LICENSES.md index d5dbded66a..2e0aebc982 100644 --- a/THIRD-PARTY-LICENSES.md +++ b/THIRD-PARTY-LICENSES.md @@ -156,7 +156,6 @@ Transitive dependencies should be audited before a final external release. | web | development | npm | `@types/node-forge` | `1.3.14` | MIT | | web | development | npm | `@types/react` | `19.2.17` | MIT | | web | development | npm | `@types/react-dom` | `19.2.3` | MIT | -| web | development | npm | `@typescript/native-preview` | `7.0.0-dev.20260707.2` | Apache-2.0 | | web | development | npm | `@xyflow/react` | `12.11.2` | MIT | | web | development | npm | `embla-carousel-react` | `8.6.0` | MIT | | web | development | npm | `jsdom` | `29.1.1` | MIT | diff --git a/web/AGENTS.md b/web/AGENTS.md index fbbc66ee4c..d331386010 100644 --- a/web/AGENTS.md +++ b/web/AGENTS.md @@ -83,7 +83,7 @@ - **表达式**:禁止 2 层及以上嵌套三元表达式;改用 `if-else`、提前返回或抽取函数。单层三元可保留,但需简洁。 - **可读性**:控制函数圈复杂度,复杂逻辑拆成小函数;变量与函数命名需有意义,遵循驼峰等常规约定。 - **TypeScript**:避免 `any`,优先具体类型或 `unknown`;为参数与返回值显式标注类型;仅类型用途的导入使用 `import type { X } from '...'`。 -- **类型检查**:每次改动 TypeScript 或 TSX 代码后都要执行类型检查(如 `bun run typecheck`);若出现类型错误,须修复至无错误为止,不得遗留。 +- **类型检查**:每次改动 TypeScript 或 TSX 代码后都要执行类型检查(如 `bun check -b`);若出现类型错误,须修复至无错误为止,不得遗留。 - **Lint 检查**:每次完成代码改动前,必须对所涉及文件执行 lint 检查,并修复这些文件中的所有 lint error;不得遗留 error。warning 可按变更范围与风险评估处理。 - **解构**:对象非必要不要进行解构,特别是组件的 props;直接使用 `props.xxx` 更清晰,避免不必要的解构增加代码复杂度。 @@ -194,7 +194,7 @@ - 测试必须保护真实用户行为、稳定 API 契约或明确回归路径;禁止为了覆盖率添加 smoke、sleep/timing、随机输入、日志输出或只证明代码运行的测试。 - 新增或大幅重写测试时优先使用 Vitest 与 React Testing Library 的标准断言和查询方式,避免手写通用断言辅助函数;只有表达项目特定业务不变量时才抽取测试 helper。 - 清理测试时先合并重复场景、删除不明不白的实现细节断言;若旧测试间接覆盖了真实契约,需替换为更小、更直接的行为测试。 -- 提交前必须至少运行受影响测试文件,并根据影响范围执行相关测试集、`bun run typecheck` 和涉及文件的 lint;不得在未看到最新通过结果的情况下声明测试完成。 +- 提交前必须至少运行受影响测试文件,并根据影响范围执行相关测试集、`bun check -b` 和涉及文件的 lint;不得在未看到最新通过结果的情况下声明测试完成。 ### 3.15 依赖管理 @@ -203,7 +203,7 @@ ### 3.16 构建与部署 -- 使用 Rsbuild,配置见 `rsbuild.config.ts`;脚本以 `package.json` 为准(如 `bun run dev`、`bun run build`、`bun run typecheck`、`bun run lint`、`bun run format`),包管理见 [3.15 依赖管理](#315-依赖管理)。 +- 使用 Rsbuild,配置见 `rsbuild.config.ts`;脚本以 `package.json` 为准(如 `bun run dev`、`bun run build`、`bun check -b`、`bun run lint`、`bun run format`),包管理见 [3.15 依赖管理](#315-依赖管理)。 - 代码分割与懒加载策略见 [3.4 性能](#34-性能);资源使用合适格式与压缩,环境变量用 `.env` 且以 `VITE_` 前缀,不在代码中硬编码。 - **发布前**:执行 typecheck、lint、format 检查,完成生产构建并检查产物体积与环境变量配置。 diff --git a/web/bun.lock b/web/bun.lock index 59bef5fbd0..9fcd8976a1 100644 --- a/web/bun.lock +++ b/web/bun.lock @@ -81,7 +81,6 @@ "@types/node-forge": "^1.3.14", "@types/react": "^19.2.17", "@types/react-dom": "^19.2.3", - "@typescript/native-preview": "^7.0.0-dev.20260702.3", "@xyflow/react": "^12.11.1", "embla-carousel-react": "^8.6.0", "jsdom": "^29.1.1", @@ -1008,22 +1007,6 @@ "@types/validate-npm-package-name": ["@types/validate-npm-package-name@4.0.2", "", {}, "sha512-lrpDziQipxCEeK5kWxvljWYhUvOiB2A9izZd9B2AFarYAkqZshb4lPbRs7zKEic6eGtH8V/2qJW+dPp9OtF6bw=="], - "@typescript/native-preview": ["@typescript/native-preview@7.0.0-dev.20260707.2", "", { "optionalDependencies": { "@typescript/native-preview-darwin-arm64": "7.0.0-dev.20260707.2", "@typescript/native-preview-darwin-x64": "7.0.0-dev.20260707.2", "@typescript/native-preview-linux-arm": "7.0.0-dev.20260707.2", "@typescript/native-preview-linux-arm64": "7.0.0-dev.20260707.2", "@typescript/native-preview-linux-x64": "7.0.0-dev.20260707.2", "@typescript/native-preview-win32-arm64": "7.0.0-dev.20260707.2", "@typescript/native-preview-win32-x64": "7.0.0-dev.20260707.2" }, "bin": { "tsgo": "bin/tsgo" } }, "sha512-oUGp+Rep/hqMhPunyinsALUwSlzHINSxitifPiSaeqoKOKD2OlR9NE3TaPqwsl4NlGslsOSUXI1JotWQzpYCPg=="], - - "@typescript/native-preview-darwin-arm64": ["@typescript/native-preview-darwin-arm64@7.0.0-dev.20260707.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-wny2pgKjGbiZtnOIHVa3tXC1UfDqxNEFzyPGmiqybedG8hipG2Nfp0l5UxbaKCjkLacUpH/W5bP2hBOMVhCOzg=="], - - "@typescript/native-preview-darwin-x64": ["@typescript/native-preview-darwin-x64@7.0.0-dev.20260707.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-Afc7M5zOwo+GpfcYwz5Z8HMB2tPVsui7nNIqEuuFB73MPdVqNn/Wmpe4tP4MRri0AtJnJknoHBaTJ/VDAp/Jhw=="], - - "@typescript/native-preview-linux-arm": ["@typescript/native-preview-linux-arm@7.0.0-dev.20260707.2", "", { "os": "linux", "cpu": "arm" }, "sha512-hJm/UOqZTr9FHmR7uNm8VGX4oKtfWk0Jem0zPeJFNC8ckGUfSBueyiEYMZB+XmRc1aG4x1E46y3CplP4CLHvGQ=="], - - "@typescript/native-preview-linux-arm64": ["@typescript/native-preview-linux-arm64@7.0.0-dev.20260707.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-iITBa2WjjTI5N9t5l7Z4KoOSI+2zBlhbvFzsD/f8qX8QoKjz/Y4DPyBDgezYi8nkqjjksbgSOJ3/ykzhwrB9cg=="], - - "@typescript/native-preview-linux-x64": ["@typescript/native-preview-linux-x64@7.0.0-dev.20260707.2", "", { "os": "linux", "cpu": "x64" }, "sha512-du0dzi6y97Po5vDNdPJTyyijHCpaS22JLRnKZEJXBDaO9gCIymOv/5QQokFRuOlQm0bWl3i9PF4OVdGP6uAOQA=="], - - "@typescript/native-preview-win32-arm64": ["@typescript/native-preview-win32-arm64@7.0.0-dev.20260707.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-SsAwfhyHJ1akgBc+99z4+hwdbHsdWaKB8EwCNIMA6JfSLMeUjffrYvxu+vfMyxVtOVOz7RrRXRoiDiu4a2sCtg=="], - - "@typescript/native-preview-win32-x64": ["@typescript/native-preview-win32-x64@7.0.0-dev.20260707.2", "", { "os": "win32", "cpu": "x64" }, "sha512-DL4u27stv0fo71sVhOzHSwE+YMZsbBijVI+kg5dLDLilSH79WFTJ8RSQ46vJrCMt+Gjlv/JOZP1PuLJDfioYeQ=="], - "@ungap/structured-clone": ["@ungap/structured-clone@1.3.3", "", {}, "sha512-60YRaenCQcVjYEKOcG824+DRGGIQ3VKErcBoAEDJZz5bKIs2ZG+X/H9Nk+Q6EVkwJk5QNApxbrc5QtBSwtrXAg=="], "@upsetjs/venn.js": ["@upsetjs/venn.js@2.0.0", "", { "optionalDependencies": { "d3-selection": "^3.0.0", "d3-transition": "^3.0.1" } }, "sha512-WbBhLrooyePuQ1VZxrJjtLvTc4NVfpOyKx0sKqioq9bX1C1m7Jgykkn8gLrtwumBioXIqam8DLxp88Adbue6Hw=="], diff --git a/web/package.json b/web/package.json index 9fff4492bd..76edba62e6 100644 --- a/web/package.json +++ b/web/package.json @@ -6,8 +6,8 @@ "scripts": { "dev": "rsbuild dev", "build": "rsbuild build", - "build:check": "tsgo -b && rsbuild build", - "typecheck": "tsgo -b", + "build:check": "bun check -b && rsbuild build", + "typecheck": "bun check -b", "lint": "oxlint -c .oxlintrc.json .", "lint:fix": "oxlint -c .oxlintrc.json . --fix", "lint:plugins": "cd ../plugins && oxlint -c .oxlintrc.json .", @@ -100,7 +100,6 @@ "@types/node-forge": "^1.3.14", "@types/react": "^19.2.17", "@types/react-dom": "^19.2.3", - "@typescript/native-preview": "^7.0.0-dev.20260702.3", "@xyflow/react": "^12.11.1", "embla-carousel-react": "^8.6.0", "jsdom": "^29.1.1", @@ -123,5 +122,6 @@ "postcss": "8.5.15", "qs": "6.15.2", "uuid": "14.0.0" - } + }, + "packageManager": "bun@1.4.4" }