chore: 清理项目冗余文件和构建中间产物
删除根目录 index.ts(与 start 脚本重复)、移除 package.json 中无效的 module 字段、构建成功后自动清理 .build/ 目录
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
- **THEN** 生成的嵌入资源模块 SHALL 保持语义一致且不依赖文件系统遍历顺序
|
- **THEN** 生成的嵌入资源模块 SHALL 保持语义一致且不依赖文件系统遍历顺序
|
||||||
|
|
||||||
### Requirement: 单 executable 输出
|
### Requirement: 单 executable 输出
|
||||||
生产构建 SHALL 输出一个 standalone executable,其中包含 Bun 后端、必要 server 依赖和构建后的前端资源。
|
生产构建 SHALL 输出一个 standalone executable,其中包含 Bun 后端、必要 server 依赖和构建后的前端资源。构建成功后 SHALL 自动清理中间产物目录(`.build/`),构建失败时 SHALL 保留中间产物以便排查。
|
||||||
|
|
||||||
#### Scenario: 在目标机器运行 executable
|
#### Scenario: 在目标机器运行 executable
|
||||||
- **WHEN** 生成的 executable 在兼容目标平台上运行
|
- **WHEN** 生成的 executable 在兼容目标平台上运行
|
||||||
@@ -41,6 +41,14 @@
|
|||||||
- **WHEN** 生成的 executable 启动,且浏览器打开前端根路径
|
- **WHEN** 生成的 executable 启动,且浏览器打开前端根路径
|
||||||
- **THEN** 页面 SHALL 展示同一个 executable 进程中 `/api/demo` 返回的数据
|
- **THEN** 页面 SHALL 展示同一个 executable 进程中 `/api/demo` 返回的数据
|
||||||
|
|
||||||
|
#### Scenario: 构建成功后清理中间产物
|
||||||
|
- **WHEN** 生产构建成功完成并输出 executable
|
||||||
|
- **THEN** 系统 SHALL 自动删除 `.build/` 目录及其所有内容
|
||||||
|
|
||||||
|
#### Scenario: 构建失败时保留中间产物
|
||||||
|
- **WHEN** 生产构建在任意步骤失败(前端构建、中间产物生成、Bun 编译)
|
||||||
|
- **THEN** `.build/` 目录 SHALL 保留在磁盘上以供排查
|
||||||
|
|
||||||
### Requirement: 外部运行时配置
|
### Requirement: 外部运行时配置
|
||||||
executable MUST 将环境相关运行时配置保留在嵌入的前端和 server bundle 之外。
|
executable MUST 将环境相关运行时配置保留在嵌入的前端和 server bundle 之外。
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "gateway-checker",
|
"name": "gateway-checker",
|
||||||
"module": "src/server/dev.ts",
|
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ if (!result.success) {
|
|||||||
|
|
||||||
console.log(`Built executable: ${executablePath}`);
|
console.log(`Built executable: ${executablePath}`);
|
||||||
|
|
||||||
|
await rm(buildDir, { recursive: true, force: true });
|
||||||
|
|
||||||
async function listFiles(directory: string): Promise<string[]> {
|
async function listFiles(directory: string): Promise<string[]> {
|
||||||
const entries = await readdir(directory, { withFileTypes: true });
|
const entries = await readdir(directory, { withFileTypes: true });
|
||||||
const files = await Promise.all(
|
const files = await Promise.all(
|
||||||
|
|||||||
Reference in New Issue
Block a user