refactor(layout): 根目录脚本归位 src/ 与 scripts/,sql.d.ts 下沉到 db/

- bin.ts → src/bin.ts (生产入口归并到 src/,import 改用 #package + @/cli/*)
- compile.ts → scripts/compile.ts (开发期工具)
- embed-migrations.ts → scripts/embed-migrations.ts (codegen)
- src/sql.d.ts → src/server/db/sql.d.ts (与唯一消费者 migrations.gen.ts 共址)

效果:项目根从 3 个零散 .ts 减为 0 个,src/ 是完整应用源码,scripts/
明确区分开发期工具。所有 package.json scripts、AGENTS.md layout/CLI 章节、
compile.ts ENTRYPOINT 与 .js.map 清理路径同步更新。

验证:fix / typecheck / test 3/3 / build 570ms / compile 117M / docker
compose 全套(migrate 干净的 logger=cli.migrate JSON 日志、app /health
200、POST /api/todo/create 成功)。
This commit is contained in:
2026-04-25 16:50:48 +08:00
parent f8af18cff5
commit 815ee31f95
6 changed files with 36 additions and 34 deletions
+9 -9
View File
@@ -10,18 +10,18 @@
},
"scripts": {
"build": "bunx --bun vite build",
"cli": "bun bin.ts",
"compile": "bun compile.ts",
"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 compile.ts --target bun-darwin-arm64",
"compile:darwin:x64": "bun compile.ts --target bun-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 compile.ts --target bun-linux-arm64",
"compile:linux:x64": "bun compile.ts --target bun-linux-x64",
"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 compile.ts --target bun-windows-x64",
"db:embed": "bun embed-migrations.ts",
"db:generate": "drizzle-kit generate && bun embed-migrations.ts",
"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",