fix: 修正 middleware 导入路径、清理 catalog 冗余项、同步文档

This commit is contained in:
2026-03-05 11:22:49 +08:00
parent 02bdfffe79
commit 04b8dedb3e
5 changed files with 5 additions and 12 deletions

View File

@@ -20,18 +20,12 @@ Guidelines for AI agents working in this Bun monorepo.
```bash ```bash
bun dev # Start all apps in dev mode bun dev # Start all apps in dev mode
bun build # Build all apps bun build # Build all apps
bun compile # Compile server to standalone binary (current platform, depends on build)
bun compile:linux # Compile server for Linux binaries (x64 + arm64)
bun compile:darwin # Compile server for macOS binaries (arm64 + x64)
bun compile:windows # Compile server for Windows x64 binary
bun dist # Full packaging pipeline: server build → compile → desktop distributable (current platform)
bun dist:linux # Full pipeline → Linux distributables (x64 + arm64)
bun dist:mac # Full pipeline → macOS distributables (arm64 + x64)
bun dist:win # Full pipeline → Windows distributable
bun fix # Lint + format (Biome auto-fix) bun fix # Lint + format (Biome auto-fix)
bun typecheck # TypeScript check across monorepo bun typecheck # TypeScript check across monorepo
``` ```
> **Note:** `compile` and `dist` commands are app-level — run them inside `apps/server/` or `apps/desktop/` directly.
### Server App (`apps/server`) ### Server App (`apps/server`)
```bash ```bash
bun dev # Vite dev server (localhost:3000) bun dev # Vite dev server (localhost:3000)

View File

@@ -275,4 +275,5 @@ export const env = createEnv({
- Use RQBv1 callback-style `orderBy` / old `relations()` API - Use RQBv1 callback-style `orderBy` / old `relations()` API
- Use `drizzle-orm/bun-sql` driver (use `drizzle-orm/postgres-js`) - Use `drizzle-orm/bun-sql` driver (use `drizzle-orm/postgres-js`)
- Pass `schema` to `drizzle()` constructor (only `relations` is needed in RQBv2) - Pass `schema` to `drizzle()` constructor (only `relations` is needed in RQBv2)
- Import `os` from `@orpc/server` in middleware — use `@/server/api/server` (the local typed instance)
- Leave docs out of sync with code changes - Leave docs out of sync with code changes

View File

@@ -11,6 +11,7 @@ export const handleValidationError = (error: unknown) => {
error.code === 'BAD_REQUEST' && error.code === 'BAD_REQUEST' &&
error.cause instanceof ValidationError error.cause instanceof ValidationError
) { ) {
// If you only use Zod you can safely cast to ZodIssue[] (per ORPC official docs)
const zodError = new z.ZodError(error.cause.issues as z.core.$ZodIssue[]) const zodError = new z.ZodError(error.cause.issues as z.core.$ZodIssue[])
throw new ORPCError('INPUT_VALIDATION_FAILED', { throw new ORPCError('INPUT_VALIDATION_FAILED', {

View File

@@ -1,4 +1,4 @@
import { os } from '@orpc/server' import { os } from '@/server/api/server'
import { getDB } from '@/server/db' import { getDB } from '@/server/db'
export const db = os.middleware(async ({ context, next }) => { export const db = os.middleware(async ({ context, next }) => {

View File

@@ -19,7 +19,6 @@
"typescript": "^5.9.3" "typescript": "^5.9.3"
}, },
"catalog": { "catalog": {
"@biomejs/biome": "^2.3.11",
"@orpc/client": "^1.13.6", "@orpc/client": "^1.13.6",
"@orpc/contract": "^1.13.6", "@orpc/contract": "^1.13.6",
"@orpc/openapi": "^1.13.6", "@orpc/openapi": "^1.13.6",
@@ -52,8 +51,6 @@
"react-dom": "^19.2.4", "react-dom": "^19.2.4",
"tailwindcss": "^4.2.1", "tailwindcss": "^4.2.1",
"tree-kill": "^1.2.2", "tree-kill": "^1.2.2",
"turbo": "^2.7.5",
"typescript": "^5.9.3",
"uuid": "^13.0.0", "uuid": "^13.0.0",
"vite": "^8.0.0-beta.16", "vite": "^8.0.0-beta.16",
"vite-tsconfig-paths": "^6.1.1", "vite-tsconfig-paths": "^6.1.1",