Skip to content

修复部署:APP_VERSION 替换丢失引号 + me.ts 格式检查失败 - #108

Merged
todosdev[bot] merged 1 commit into
mainfrom
tds/conv-01a148cd-9b88-7c28-a7ae-3eeacfe7a31e
Oct 17, 2026
Merged

todosdev[bot] merged 1 commit into
mainfrom
tds/conv-01a148cd-9b88-7c28-a7ae-3eeacfe7a31e

Conversation

@todosdev

@todosdev todosdev Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • 修复自 9/30 起中断的自动部署:[define] APP_VERSION 的版本号替换在提交 bb30985 迁移时丢失了单引号,导致 wrangler 把 1.0.0 当作无效 JS 表达式(Invalid define value)而失败。
  • 修正 worker/src/routes/me.ts 的 biome 格式问题(此前使 CI 的 Format check 失败、进而跳过 Deploy)。

Changes

  • .github/workflows/deploy.yml:perl 替换改为 s/__APP_VERSION__/'\''$ENV{APP_VERSION}'\''/g;,用 shell 单引号转义 '\'' 给版本号包上单引号,替换后得到合法 TOML 的 APP_VERSION = "'1.0.0'"([define] 值作为 JS 字符串字面量 '1.0.0' 内联)。
  • scripts/deploy.mjs:original.replaceAll("__APP_VERSION__", \'${version}'`)`,与 workflow 保持一致地把版本号写成带引号的 JS 字符串字面量。
  • worker/src/routes/me.ts:仅用 biome format --write 重排 records.map(...) 回调的缩进,无逻辑改动。

worker/wrangler.toml 保持不动(APP_VERSION = "__APP_VERSION__" 占位写法为有意设计,本地开发由 typeof APP_VERSION !== "undefined" 兜底)。

Testing

  • pnpm lint、pnpm format:check、pnpm typecheck、pnpm build 全部通过(exit 0)。
  • 分别模拟 workflow 的 perl 替换与 deploy.mjs 替换,均输出 APP_VERSION = "'1.0.0'"。
  • 用假资源 ID 补全占位符后运行 wrangler deploy --dry-run,不再报 Invalid define value,打包产物中版本已内联为字符串:version: true ? "1.0.0" : "0.0.0";验证后 wrangler.toml 已恢复为占位写法。

bb30985 dropped the single quotes when migrating the __APP_VERSION__
replacement, so wrangler parsed "1.0.0" as an invalid define value and
deploy failed. Wrap the version in single quotes in both the workflow
perl substitution and scripts/deploy.mjs so it lands as the JS literal
'1.0.0'. Also apply biome formatting to worker/src/routes/me.ts, whose
records.map block was failing CI's format check and skipping deploys.

Checkpoint: RBEToLtNypnGGwg6Ggk-h
@todosdev
todosdev Bot merged commit bc23ee8 into main Oct 17, 2026
1 check passed
@mapxn
mapxn deleted the tds/conv-01a148cd-9b88-7c28-a7ae-3eeacfe7a31e branch October 18, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants