refactor: 统一打包命令为 dist 体系,build 仅编译不打包

- build:linux/mac/win → dist/dist:linux/dist:mac/dist:win
- Turbo 任务依赖:desktop#dist:* → server#compile → server#build
- 根目录 bun dist 一条命令完成完整打包流水线
- 更新 AGENTS.md 文档同步命令变更
This commit is contained in:
2026-02-08 20:48:58 +08:00
parent 8c0ea632d7
commit dac6bb1643
6 changed files with 48 additions and 14 deletions

View File

@@ -20,6 +20,11 @@ Guidelines for AI agents working in this Bun monorepo.
```bash
bun dev # Start all apps in dev mode
bun build # Build all apps
bun compile # Compile server to standalone binary (depends on build)
bun dist # Full packaging pipeline: server build → compile → desktop distributable (current platform)
bun dist:linux # Full pipeline → Linux distributable
bun dist:mac # Full pipeline → macOS distributable
bun dist:win # Full pipeline → Windows distributable
bun fix # Lint + format (Biome auto-fix)
bun typecheck # TypeScript check across monorepo
```
@@ -43,9 +48,10 @@ bun db:studio # Open Drizzle Studio
```bash
bun dev # electron-vite dev mode (requires server dev running)
bun build # electron-vite build (main + preload)
bun build:win # Build + package for Windows
bun build:mac # Build + package for macOS
bun build:linux # Build + package for Linux
bun dist # Build + package for current platform
bun dist:linux # Build + package for Linux
bun dist:mac # Build + package for macOS
bun dist:win # Build + package for Windows
bun fix # Biome auto-fix
bun typecheck # TypeScript check
```

View File

@@ -24,9 +24,10 @@ Thin Electron shell hosting the fullstack server app.
```bash
bun dev # electron-vite dev (requires server dev running)
bun build # electron-vite build (main + preload)
bun build:win # Build + package for Windows
bun build:mac # Build + package for macOS
bun build:linux # Build + package for Linux
bun dist # Build + package for current platform
bun dist:linux # Build + package for Linux
bun dist:mac # Build + package for macOS
bun dist:win # Build + package for Windows
bun fix # Biome auto-fix
bun typecheck # TypeScript check
```
@@ -57,10 +58,15 @@ bun typecheck # TypeScript check
## Production Build Workflow
1. **Build server**: `bun build` in `apps/server``.output/`
2. **Compile server**: `bun compile` in `apps/server``out/server-{platform}`
3. **Copy binary**: Copy the platform-appropriate binary to `apps/desktop/resources/server`
4. **Package desktop**: `bun build:linux` (or `:mac` / `:win`) in `apps/desktop`
From monorepo root, run `bun dist` to execute the full pipeline automatically (via Turbo task dependencies):
1. **Build server**: `apps/server``vite build``.output/`
2. **Compile server**: `apps/server``bun compile.ts``out/server-{platform}`
3. **Package desktop**: `apps/desktop``electron-vite build` + `electron-builder` → distributable
The `electron-builder.yml` `extraResources` config reads binaries directly from `../server/out/`, no manual copy needed.
To build for a specific platform explicitly, use `bun dist:linux` / `bun dist:mac` / `bun dist:win` in `apps/desktop`.
## Critical Rules

View File

@@ -9,10 +9,11 @@
"main": "out/main/index.js",
"scripts": {
"build": "electron-vite build",
"build:linux": "electron-vite build && electron-builder --linux --config",
"build:mac": "electron-vite build && electron-builder --mac --config",
"build:win": "electron-vite build && electron-builder --win --config",
"dev": "electron-vite dev",
"dist": "bun run build && electron-builder --config",
"dist:linux": "bun run build && electron-builder --linux --config",
"dist:mac": "bun run build && electron-builder --mac --config",
"dist:win": "bun run build && electron-builder --win --config",
"fix": "biome check --write",
"typecheck": "tsc --noEmit"
},

View File

@@ -25,7 +25,8 @@ bun db:studio # Drizzle Studio GUI
# Build
bun build # Production build → .output/
bun compile # Compile to standalone binary
bun compile # Compile to standalone binary (depends on build)
# Also triggered automatically by root `bun dist`
# Code Quality
bun fix # Biome auto-fix

View File

@@ -11,6 +11,10 @@
"build": "turbo run build",
"compile": "turbo run compile",
"dev": "turbo run dev",
"dist": "turbo run dist",
"dist:linux": "turbo run dist:linux",
"dist:mac": "turbo run dist:mac",
"dist:win": "turbo run dist:win",
"fix": "turbo run fix",
"typecheck": "turbo run typecheck"
},

View File

@@ -9,6 +9,22 @@
"compile": {
"dependsOn": ["build"]
},
"dist": {},
"dist:linux": {},
"dist:mac": {},
"dist:win": {},
"@furtherverse/desktop#dist": {
"dependsOn": ["@furtherverse/server#compile"]
},
"@furtherverse/desktop#dist:linux": {
"dependsOn": ["@furtherverse/server#compile"]
},
"@furtherverse/desktop#dist:mac": {
"dependsOn": ["@furtherverse/server#compile"]
},
"@furtherverse/desktop#dist:win": {
"dependsOn": ["@furtherverse/server#compile"]
},
"dev": {
"cache": false,
"persistent": true