Commit e1dbe420 by 张立顺

docs: record miniprogram npm reduction evidence

1 parent 7f0f12d3
......@@ -24,19 +24,22 @@
"id": "npm-dependency-prune",
"file": "tests/work-order-migration/npm-dependency-prune.test.mjs",
"level": "unit",
"expectedBefore": "fail"
"expectedBefore": "pass",
"status": "pass"
},
{
"id": "npm-artifact-prune",
"file": "tests/work-order-migration/npm-upload-prune.test.mjs",
"level": "unit",
"expectedBefore": "pass"
"expectedBefore": "pass",
"status": "pass"
},
{
"id": "upload-config-boundary",
"file": "tests/work-order-migration/upload-config.test.mjs",
"level": "integration",
"expectedBefore": "pass"
"expectedBefore": "pass",
"status": "pass"
}
],
"baseline": {
......@@ -44,5 +47,17 @@
"result": "70c239a"
},
"apiInventory": "docs/migrations/miniprogram-npm-size-reduction/api-inventory.md",
"acceptance": "docs/migrations/miniprogram-npm-size-reduction/test-acceptance.md"
"acceptance": "docs/migrations/miniprogram-npm-size-reduction/test-acceptance.md",
"verification": {
"commands": [
{
"command": "npm run test:workOrderMigration",
"status": "pass"
},
{
"command": "npm run check:workOrderClosure",
"status": "pass"
}
]
}
}
# miniprogram_npm 体积优化验收
## 基线
## 基线与清理后结果
| 指标 | 基线值 |
| --- | --- |
| `miniprogram_npm` 文件数 | 712 |
| `miniprogram_npm` 字节数 | 1,648,929 |
| source map 数量 | 49 |
| source map 字节数 | 540,083 |
| `glsx-applet-component` 文件数 | 118 |
| `glsx-applet-component` 字节数 | 423,591 |
| 指标 | 清理前 | 清理后 | 变化 |
| --- | ---: | ---: | ---: |
| `miniprogram_npm` 文件数 | 712 | 567 | -145 |
| `miniprogram_npm` 字节数 | 1,648,929 | 863,329 | -785,600(-47.64%) |
| `miniprogram_npm` MiB | 1.572541 | 0.823335 | -0.749206 |
| source map 数量 | 49 | 0 | -49 |
| source map 字节数 | 540,083 | 0 | -540,083 |
| `glsx-applet-component` 文件数 | 118 | 0 | -118 |
| `glsx-applet-component` 字节数 | 423,591 | 0 | -423,591 |
清理前的 source map 中有 22 个位于 `glsx-applet-component` 内,因此插件体积与 source map 体积有重叠,不能从总字节数中重复扣减。实测清理后为 863,329 字节,而不是按两项简单相加估算出的约 0.65 MiB。
## 生成产物验收
## 预期后置状态
- `glsx-applet-component`:不存在。
- `glsk-applet-component`:存在,保留隐私组件运行依赖。
- source map:0 个。
- 嵌套 `miniprogram_npm/miniprogram_npm`:不存在。
- 清理前其余顶层包为 `@vant`、`dayjs`、`glsk-applet-component`、`glsx-common-sdk`、`number-precision`、`rfdc`;清理后六项均仍存在。
- 已提交的清理函数输出:`{ removedNestedNpm: false, removedSourceMaps: 27 }`。定向删除的插件目录已同时移除其中 22 个 source map,总计移除 49 个。
- `miniprogram_npm` 中 source map 数量为 0。
- 不再生成 `miniprogram_npm/glsx-applet-component`。
- 保留隐私组件 `glsk-applet-component/GlsxPrivacy/index` 及其 `app.json` 注册。
生成目录被 Git 忽略,可通过微信开发者工具“工具 → 构建 npm”重新生成。
## 验证命令
## 验证结果
验证进程将 `C:\Users\admin\.cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin` 置于 `PATH` 首位,实际运行时为 Node `v24.14.0`、npm `10.8.2`,满足项目的 `>=24 <25` 约束。post gate 及其启动的两条 verification 命令继承同一 Node 24 进程环境。
| 命令 | 结果 |
| --- | --- |
| `npm run test:workOrderMigration`(Node v24.14.0) | 通过:61 tests,17 suites,61 pass,0 fail,0 cancelled,0 skipped |
| `npm run check:workOrderClosure`(Node v24.14.0) | 通过:扫描 234 个文件;0 缺失依赖、0 死路由、0 缺失 API 方法 |
| `npm run check:migration -- --manifest docs/migrations/miniprogram-npm-size-reduction/manifest.json --phase post`(Node v24.14.0) | 通过:输出 `Migration readiness post check passed`,并在同一 Node 24 环境中重跑两条 verification 命令 |
```powershell
npm run test:workOrderMigration
npm run check:workOrderClosure
```
准备阶段曾在 Node v20.19.0 下运行验证;该结果不作为最终迁移证据。首次运行测试时,本地 `node_modules` 缺少已由 `package.json` 和 `package-lock.json` 声明的 `@babel/parser` 与 `@babel/generator`,因此 45 tests 中 41 pass、4 个测试文件加载失败。执行 `npm ci` 从已提交锁文件恢复依赖后,最终完整证据全部在上述 Node v24.14.0 环境下重新取得;该操作不使用 `yarn.lock`。
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!