示例工程 56-auto-update
56-auto-update/app/README.md
# 56-auto-update / app
自动更新决策台:解析 macOS `releases.json` 与 Windows `RELEASES`,比较版本,
输出“有更新/已最新/feed 错误”,并展示四类更新方案与官方服务门槛。
**不下载、不替换安装包**,提示状态只影响 UI。
## 运行
```bash
pnpm --filter @tutorial/56-auto-update-app start
pnpm --filter @tutorial/56-auto-update-app smoke
pnpm --filter @tutorial/56-auto-update-app shots
```
## smoke 输出
```json
{"evt":"smoke","ok":true,"score":100,"checks":10,"passed":10,
"schemes":4,"feeds":4,"macStatus":"update","macLatest":"1.2.0",
"winStatus":"update","winLatest":"1.2.0","noneStatus":"none",
"invalidStatus":"error","noInstall":true}
```
## 结构
- `fixtures/releases.json`:macOS feed
- `fixtures/RELEASES`:Windows Squirrel feed
- `fixtures/no-update.json` / `invalid.txt`:无更新与损坏 feed
- `shared/feed.ts`:版本比较、feed 解析、决策、官方门槛
- `src/App.ts`:方案表、feed 切换、决策与提示状态
## testid
| testid | 用途 |
| --- | --- |
| `score` / `scheme-count` | 自检与方案数 |
| `schemes` / `scheme-row` | 四类更新方案 |
| `feed-mac` / `feed-win` / `feed-none` / `feed-invalid` | feed 切换 |
| `decision` / `decision-state` | 决策结果 |
| `prompt-actions` / `prompt-note` | 提示状态(不安装) |
| `eligibility` / `checks` | 官方门槛与自检 |
## 已知限制
- 不调用 `autoUpdater` / `update-electron-app` / `electron-updater`,只验证 feed 与决策层。
- 不验证签名、差分包与安装替换(见第 53 章与本章“限制”)。
- 官方服务门槛来自官方文档,未在真实 GitHub 仓库上跑通。