chore: 重构 Turbo 构建配置并强化 Bun 专用说明

将应用特定的构建输出配置下沉至各自 turbo.json,根级 build 任务添加拓扑依赖;AGENTS.md 统一添加 Bun 专用运行时警告;桌面端启用 Linux CEF 渲染器。
This commit is contained in:
2026-02-07 16:14:55 +08:00
parent 44ca7a0f5e
commit adb14cff77
8 changed files with 31 additions and 7 deletions

View File

@@ -4,8 +4,11 @@ Guidelines for AI agents working in this Bun monorepo.
## Project Overview ## Project Overview
> **⚠️ This project uses [Bun](https://bun.sh) exclusively as both the JavaScript runtime and package manager. Do NOT use Node.js / npm / yarn / pnpm. All commands start with `bun` — use `bun install` for dependencies and `bun run` / `bun <script>` for scripts. Never use `npm`, `npx`, or `node`.**
- **Monorepo**: Bun workspaces + Turborepo orchestration - **Monorepo**: Bun workspaces + Turborepo orchestration
- **Runtime**: Bun (see `mise.toml` for version) - **Runtime**: Bun (see `mise.toml` for version)**NOT Node.js**
- **Package Manager**: Bun — **NOT npm / yarn / pnpm**
- **Apps**: - **Apps**:
- `apps/server` - TanStack Start fullstack web app (see `apps/server/AGENTS.md`) - `apps/server` - TanStack Start fullstack web app (see `apps/server/AGENTS.md`)
- `apps/desktop` - Tauri v2 desktop shell, loads server via sidecar (see `apps/desktop/AGENTS.md`) - `apps/desktop` - Tauri v2 desktop shell, loads server via sidecar (see `apps/desktop/AGENTS.md`)
@@ -153,6 +156,7 @@ export const myTable = pgTable('my_table', {
- Include `createdAt`/`updatedAt` on all tables - Include `createdAt`/`updatedAt` on all tables
**DON'T:** **DON'T:**
- Use `npm`, `npx`, `node`, `yarn`, `pnpm` — always use `bun` / `bunx`
- Edit `src/routeTree.gen.ts` (auto-generated) - Edit `src/routeTree.gen.ts` (auto-generated)
- Use `as any`, `@ts-ignore`, `@ts-expect-error` - Use `as any`, `@ts-ignore`, `@ts-expect-error`
- Commit `.env` files - Commit `.env` files

View File

@@ -2,6 +2,8 @@
Electrobun desktop shell - loads the server app in a native window. Electrobun desktop shell - loads the server app in a native window.
> **⚠️ This project uses Bun — NOT Node.js / npm. All commands use `bun`. Never use `npm`, `npx`, or `node`.**
## Architecture ## Architecture
- **Type**: Electrobun desktop application - **Type**: Electrobun desktop application
@@ -75,5 +77,6 @@ Electrobun.events.on('will-quit', () => {
- Handle server startup gracefully - Handle server startup gracefully
**DON'T:** **DON'T:**
- Use `npm`, `npx`, `node`, `yarn`, `pnpm` — always use `bun` / `bunx`
- Hardcode dependency versions (use catalog) - Hardcode dependency versions (use catalog)
- Block main thread during server wait - Block main thread during server wait

View File

@@ -10,5 +10,8 @@ export default {
bun: { bun: {
entrypoint: 'src/bun/index.ts', entrypoint: 'src/bun/index.ts',
}, },
linux: {
bundleCEF: true,
},
}, },
} satisfies ElectrobunConfig } satisfies ElectrobunConfig

View File

@@ -38,6 +38,7 @@ async function main() {
width: 1200, width: 1200,
height: 800, height: 800,
}, },
renderer: 'cef',
}) })
Electrobun.events.on('will-quit', () => console.log('Quitting...')) Electrobun.events.on('will-quit', () => console.log('Quitting...'))

9
apps/desktop/turbo.json Normal file
View File

@@ -0,0 +1,9 @@
{
"$schema": "../../node_modules/turbo/schema.json",
"extends": ["//"],
"tasks": {
"build": {
"outputs": ["build/**", "artifacts/**"]
}
}
}

View File

@@ -4,8 +4,11 @@ TanStack Start fullstack web app with ORPC (contract-first RPC).
## Tech Stack ## Tech Stack
> **⚠️ This project uses Bun — NOT Node.js / npm. All commands use `bun`. Never use `npm`, `npx`, or `node`.**
- **Framework**: TanStack Start (React 19 SSR, file-based routing) - **Framework**: TanStack Start (React 19 SSR, file-based routing)
- **Runtime**: Bun - **Runtime**: Bun**NOT Node.js**
- **Package Manager**: Bun — **NOT npm / yarn / pnpm**
- **Language**: TypeScript (strict mode) - **Language**: TypeScript (strict mode)
- **Styling**: Tailwind CSS v4 - **Styling**: Tailwind CSS v4
- **Database**: PostgreSQL + Drizzle ORM - **Database**: PostgreSQL + Drizzle ORM
@@ -195,6 +198,7 @@ export const env = createEnv({
- Use `ORPCError` with proper codes - Use `ORPCError` with proper codes
**DON'T:** **DON'T:**
- Use `npm`, `npx`, `node`, `yarn`, `pnpm` — always use `bun` / `bunx`
- Edit `src/routeTree.gen.ts` (auto-generated) - Edit `src/routeTree.gen.ts` (auto-generated)
- Use `as any`, `@ts-ignore`, `@ts-expect-error` - Use `as any`, `@ts-ignore`, `@ts-expect-error`
- Commit `.env` files - Commit `.env` files

View File

@@ -2,6 +2,9 @@
"$schema": "../../node_modules/turbo/schema.json", "$schema": "../../node_modules/turbo/schema.json",
"extends": ["//"], "extends": ["//"],
"tasks": { "tasks": {
"build": {
"outputs": [".output/**"]
},
"compile": { "compile": {
"dependsOn": ["build"], "dependsOn": ["build"],
"outputs": ["out/**"] "outputs": ["out/**"]

View File

@@ -9,11 +9,8 @@
], ],
"tasks": { "tasks": {
"build": { "build": {
"outputs": ["dist/**", ".output/**", "build", "artifacts"] "dependsOn": ["^build"],
}, "outputs": ["dist/**"]
"compile": {
"dependsOn": ["build"],
"outputs": ["out/**"]
}, },
"dev": { "dev": {
"cache": false, "cache": false,