1
0
Files
DiAL/openspec/changes/archive/2026-05-09-add-vite-react-bun-executable/tasks.md

42 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 1. 项目结构与依赖
- [x] 1.1 创建 `src/server``src/web``src/shared``scripts` 和测试目录结构
- [x] 1.2 调整 `package.json` 脚本以覆盖前端开发、后端开发、并行开发、测试和生产构建
- [x] 1.3 引入 Vite、React、React DOM 和必要 TypeScript 类型依赖
- [x] 1.4 创建或更新 README 记录项目结构、开发规范和命令
## 2. 前端开发工作流
- [x] 2.1 创建 Vite + React + TypeScript 前端入口和基础页面
- [x] 2.2 配置 Vite 开发服务器将 `/api/*` 代理到 Bun 后端
- [x] 2.3 实现前端 demo 页面调用相对路径 `/api/demo` 并展示成功和失败状态
- [x] 2.4 建立 `src/shared` 共享类型并确保前端不引入后端运行时实现
- [x] 2.5 提供一个 documented fullstack dev command 同时启动 Vite 前端和 Bun 后端
## 3. Bun 后端运行时
- [x] 3.1 创建 Bun server 入口并支持 host 和 port 运行期配置
- [x] 3.2 实现 `/health` 健康检查响应
- [x] 3.3 实现 `/api/demo` JSON 路由并返回前端可展示的 message 和 runtime metadata
- [x] 3.4 实现未命中 `/api/*` 路由返回 JSON 404 的行为
- [x] 3.5 实现生产环境静态资源服务和 SPA fallback 行为
## 4. 单可执行程序构建
- [x] 4.1 创建生产构建脚本,确保先执行 Vite build 再执行 Bun compile
- [x] 4.2 将 Vite `dist/` 产物嵌入 Bun executable运行时不依赖外部 `dist/` 目录
- [x] 4.3 配置 executable 输出路径和当前平台默认构建目标
- [x] 4.4 确保 executable 运行不依赖本机 Node.js、Bun、Vite 或 `node_modules`
## 5. 测试与验证
- [x] 5.1 为 `/api/demo``/health`、API 404 和 SPA fallback 增加测试
- [x] 5.2 为生产构建脚本增加失败中断或防止 stale executable 的验证
- [x] 5.3 增加构建后 executable smoke test 覆盖 `/api/demo`、健康检查、静态资源、前端 fallback 和 demo 页面内容
- [x] 5.4 运行完整测试和生产构建,确认所有任务满足 specs
## 6. 文档收尾
- [x] 6.1 更新 README 中的运行参数、构建产物、部署方式和已知限制
- [x] 6.2 在 README 中记录前端可拆离原则、`/api/*` 路径约定和 demo 验证步骤