Files
fullstack-starter/package.json
T
imbytecat fafe02bdbd refactor: 主动审计修复多处可观测性、依赖、代码质量缺口
通过并行 explore + librarian + 自查发现并修复:

代码缺陷
- shutdown.ts: db.$client.end().finally(...) 静默吞错——关闭失败会
  谎报 "DB pool closed" 后照常 exit 0。改用 await + try/catch
  分别记录成功/失败,setTimeout 也换成 Bun.sleep。
- interceptors.ts: 两条 instanceof ORPCError && instanceof
  ValidationError 重复检查,改用 early return + 单 if 分支区分 code。
- types.ts: 移除从未被引用的 RouterInputs 死代码(仅 RouterOutputs
  被 TodoItem 用到)。

Bun 原生 API(删/换 Node 兼容层)
- fields.ts: uuid v7 → Bun.randomUUIDv7(),删除 uuid 依赖
- migrate.ts: node:crypto.createHash → Bun.CryptoHasher.hash,
  少一个 Promise.all 项 + 一个 import
- shutdown.ts: setTimeout → Bun.sleep(顺带)

Biome 2.4 规则补强
- domains.types: "all"——开启类型感知规则集(noFloatingPromises /
  noMisusedPromises / useAwaitThenable / noUnnecessaryConditions
  等 Promise/异步陷阱)
- domains.drizzle: "recommended"、domains.react: "recommended"
- 显式开启 suspicious.noImportCycles(2.4 已 promote)

文档
- AGENTS.md 在 Stack & runtime 段加 "Prefer Bun-native APIs"
  原则,列出 UUIDv7/SHA-256/sleep/Bun.file 的优先路径
- AGENTS.md 在 Code style (Biome) 段记录本次启用的 lint domain
  与 noImportCycles 规则

验证:fix / typecheck / test 3/3 / build 568ms / compile 117M /
docker compose 全套(migrate JSON 日志 ✓、UUIDv7 写入 ✓、SIGTERM
shutdown 正确序列化 ✓)
2026-04-25 17:06:22 +08:00

72 lines
2.5 KiB
JSON

{
"name": "fullstack-starter",
"version": "1.0.0",
"private": true,
"type": "module",
"imports": {
"#drizzle/*.sql": "./drizzle/*.sql",
"#package": "./package.json",
"#server": "./.output/server/index.mjs"
},
"scripts": {
"build": "bunx --bun vite build",
"cli": "bun src/bin.ts",
"compile": "bun scripts/compile.ts",
"compile:darwin": "bun run compile:darwin:arm64 && bun run compile:darwin:x64",
"compile:darwin:arm64": "bun scripts/compile.ts --target bun-darwin-arm64",
"compile:darwin:x64": "bun scripts/compile.ts --target bun-darwin-x64",
"compile:linux": "bun run compile:linux:x64 && bun run compile:linux:arm64",
"compile:linux:arm64": "bun scripts/compile.ts --target bun-linux-arm64",
"compile:linux:x64": "bun scripts/compile.ts --target bun-linux-x64",
"compile:windows": "bun run compile:windows:x64",
"compile:windows:x64": "bun scripts/compile.ts --target bun-windows-x64",
"db:embed": "bun scripts/embed-migrations.ts",
"db:generate": "drizzle-kit generate && bun scripts/embed-migrations.ts",
"db:migrate": "drizzle-kit migrate",
"db:push": "drizzle-kit push",
"db:studio": "drizzle-kit studio",
"dev": "bunx --bun vite dev",
"fix": "biome check --write",
"test": "bun test",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@logtape/drizzle-orm": "^2.0.5",
"@logtape/logtape": "^2.0.5",
"@logtape/pretty": "^2.0.5",
"@orpc/client": "^1.14.0",
"@orpc/contract": "^1.14.0",
"@orpc/openapi": "^1.14.0",
"@orpc/server": "^1.14.0",
"@orpc/tanstack-query": "^1.14.0",
"@orpc/zod": "^1.14.0",
"@t3-oss/env-core": "^0.13.11",
"@tanstack/react-query": "^5.100.1",
"@tanstack/react-router": "^1.168.24",
"@tanstack/react-router-ssr-query": "^1.166.11",
"@tanstack/react-start": "^1.167.48",
"citty": "^0.2.2",
"drizzle-orm": "0.45.2",
"drizzle-zod": "^0.8.3",
"postgres": "^3.4.9",
"react": "^19.2.5",
"react-dom": "^19.2.5",
"zod": "^4.3.6"
},
"devDependencies": {
"@biomejs/biome": "^2.4.13",
"@tailwindcss/vite": "^4.2.4",
"@tanstack/devtools-vite": "^0.6.0",
"@tanstack/react-devtools": "^0.10.2",
"@tanstack/react-query-devtools": "^5.100.1",
"@tanstack/react-router-devtools": "^1.166.13",
"@types/bun": "^1.3.13",
"@vitejs/plugin-react": "^6.0.1",
"drizzle-kit": "0.31.10",
"nitro": "npm:nitro-nightly@3.0.1-20260424-182106-f8cf6ccc",
"tailwindcss": "^4.2.4",
"typescript": "^6.0.3",
"vite": "^8.0.10"
}
}