build(edgeone): generate cloud-functions artifact at deploy time - #93
Merged
Merged
Conversation
…ead of committing it - .gitignore 重新忽略 cloud-functions/,并 git rm --cached 移除已提交的 cloud-functions/[[default]].js(1.8 MB 构建产物,每次后端改动都要重建提交) - 删除 .github/workflows/edgeone-artifact-guard.yml 与 tests/artifact-guard.test.ts:产物不再入库,无需再做与源码的新鲜度比对 - 新增 .github/workflows/build-verify.yml:按平台一致流程 install -> fetch-frontend -> build-edge,校验 dist/index.html、dist-server/api/[...route].js、cloud-functions/[[default]].js 均已生成,并断言该产物未被 git 跟踪 - README 及 13 个语言版本的 Build status badge 指向 build-verify - scripts/build-edge.mjs、middleware.js 注释同步说明产物由构建生成、不入库 EdgeOne 一键部署的 buildCommand(edgeone.json -> pnpm run build)已在前端 dist/ 上长期验证为部署期实时构建,云函数产物走同一条链路即可。
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
openlist-work | 1788357 | Sep 29 2026, 06:44 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
openlist-tsworkers | 1788357 | Sep 29 2026, 06:45 AM |
Member
Author
|
此PR先合并并进入CI测试,如果有问题再回退 |
zxsos
added a commit
to zxsos/openlist
that referenced
this pull request
Sep 29, 2026
同步上游 bfb963e(OpenListTeam#93:EdgeOne 产物改为部署时生成,不再入库)。 冲突处理(人工确认): - cloud-functions/[[default]].js、tests/artifact-guard.test.ts、 .github/workflows/edgeone-artifact-guard.yml —— 跟随上游删除,本仓库部署走 Cloudflare Workers。 - .github/workflows/sync-upstream.yml —— fork 自有,保留并强化: 上游删除某路径时不再盲目 checkout --theirs(那会因缺少 theirs 版本让整步失败), 改为先探测上游版本是否存在,不存在则 git rm;冲突清单改用 NUL 分隔读取。
15 of 19 tasks
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
build(edgeone): generate the cloud-functions artifact during deploy instead of committing it
Base:
main← Compare:build/edgeone-artifact-generated-at-deployCommit:
1788357· Files changed: 20 (+113 / −604)Open PR: https://github.com/OpenListTeam/OpenList-Worker/pull/new/build/edgeone-artifact-generated-at-deploy
Summary / 摘要
cloud-functions/[[default]].jsis a build artifact ofscripts/build-edge.mjs: theEdgeOne Makers Node cloud-function entry that bundles the whole backend plus the
inlined
dist/index.html. It was previously required to be committed and kept insync with the sources, so every backend change forced a full rebuild and a ~1.8 MB
minified blob commit (each
chore(edgeone): refresh cloud-functions artifact).This PR makes it a pure build output.
cloud-functions/[[default]].js是scripts/build-edge.mjs的构建产物:EdgeOneMakers 的 Node 云函数入口,内含全部后端代码与内联的
dist/index.html。此前它必须提交进仓库并与源码保持同步,于是每次后端改动都要重建并提交一个约 1.8 MB 的压缩
产物(历史上那些
chore(edgeone): refresh cloud-functions artifact提交)。本 PR把它彻底变成构建产物。
Rationale / 理由: EdgeOne's one-click deploy already builds at deploy time —
edgeone.json→buildCommand: pnpm run buildis exactly how the frontenddist/is produced today. The cloud-function artifact is generated by the very same command,
so it does not need to live in the repository.
EdgeOne 一键部署本来就是部署期构建——
edgeone.json的buildCommand: pnpm run build就是现在前端dist/的来源。云函数产物由同一条命令生成,不需要在仓库里驻留。
用户可感知的行为变化
不再需要
chore(edgeone): refresh cloud-functions artifact这类提交。pnpm run build(
edgeone makers deploy会自动构建,不受影响)。重要实现变化
.gitignore重新忽略cloud-functions/,并git rm --cached移除已提交的产物(
cloud-functions/[[default]].js,1,921,744 字节)。.github/workflows/edgeone-artifact-guard.yml与tests/artifact-guard.test.ts:产物入库才需要"新鲜度比对"守卫,现在这条开销整个消失。
.github/workflows/build-verify.yml:按平台一致流程install → fetch-frontend → build-edge,校验dist/index.html、dist-server/api/[...route].js、cloud-functions/[[default]].js均已生成,并断言该产物未被 git 跟踪(防止有人再次
git add进来)。edgeone-artifact-guard.yml改指
build-verify.yml。scripts/build-edge.mjs、middleware.js的注释同步说明"产物由构建生成、不入库"。配置 / 存储 / API 变化
无。
edgeone.json、wrangler.jsonc、环境变量、API 路由、存储格式均未改动。Related Issues / 关联 Issue
无直接 issue。来源是本仓库既有的「产物必须提交」约定:
e092379(引入 artifact guard)与74b46ac(为该约定从.gitignore删掉/cloud-functions)。本 PR 反过来把约定简化为「构建期生成」。Background / 背景:为什么当初要提交,为什么现在不用
cd8e9e3的结论是:Makers 在检出仓库时扫描cloud-functions/决定是否启用 Node函数,缺了会报
No server-handler detected并退化为纯静态项目,因此产物必须提交。但当时 EdgeOne 的构建链本身是坏的(
7e0a4b2绕过 corepack、e092379fix edge buildchain 都在修这条链),所以「构建失败 → 产物没生成 → 判定为纯静态」同样能解释当时
观察到的现象,两种解释无法区分。而可以确认的是:
buildCommand一定在部署时执行——前端dist/就是这么实时构建出来的;一起部署」,即函数目录是随构建产物打包的。
因此本次把「产物必须入库」改为「构建期生成」。
Risk & Verification / 风险与验证
本 PR 的唯一假设:平台在
buildCommand执行之后收集cloud-functions/目录。部署后 1 分钟即可判定:
No server-handler detected→ 判定早于构建,执行
git revert 1788357即可完全恢复原状(产物回到仓库,守卫工作流恢复);或者改走 CI/CLI 部署(见 Follow-ups)。
Testing / 测试
go test ./...— 本仓库为 TypeScript,不适用。已执行的检查 / Verified on branch
build/edgeone-artifact-generated-at-deploy:git ls-tree -r <branch> -- cloud-functionsgit show <branch>:.gitignore | grep cloud-functionscloud-functions/(第 54 行)已就位git ls-tree -r <branch> -- .github/workflows testsbuild-verify.yml+sync_repo.yml;tests/仅剩meta.test.tsorigin/build/edgeone-artifact-generated-at-deploy1788357,已推送build-verify未在本机重跑
pnpm run build:工作区当时存在其他会话未提交的改动,为避免互相干扰,把构建验证交给 CI(
build-verify.yml)执行。New tests / 新增测试: 无新增单测。原先的
tests/artifact-guard.test.ts断言的是已删除的守卫工作流文本,其职责由
build-verify.yml的两个 step 接替("Verify artifacts exist" 与 "Assert the EdgeOne artifact is not tracked")。
Checklist / 检查清单
/ 我已阅读 CONTRIBUTING。
/ 我确认此贡献符合仓库许可证、贡献规范和行为准则。
prettierwhere applicable./ 我已按适用情况使用
prettier格式化变更代码。/ 我已在适用情况下请求相关维护者或代码所有者审查。
AI Disclosure / AI 使用声明
Tools used / 使用工具:
Usage scope / 使用范围:
Code generation / 代码生成
Refactoring / 重构
Documentation / 文档
Tests / 测试(工作流校验步骤)
Translation / 翻译
Review assistance / 审查辅助
I have reviewed and validated all AI-assisted content included in this PR.
/ 我已审核并验证此 PR 中的所有 AI 辅助内容。
I have ensured that all AI-assisted commits include
Co-Authored-Byattribution./ 我已确保所有 AI 辅助提交都包含
Co-Authored-By归属信息。I can reproduce all AI-assisted content included in this PR without any AI tools.
/ 我可以在没有任何 AI 工具的情况下重现此 PR 中包含的所有 AI 辅助内容。
Operational Note / 运维提示
pnpm run build会生成dist/与cloud-functions/[[default]].js。edgeone makers deploy自带构建;若采用「先构建再上传」的手动方式(
edgeone makers deploy ./dist),必须先在本地跑pnpm run build,并按平台要求让函数目录随输出目录一起上传——产物不再由仓库提供。
(此前同样执行
pnpm run build,只是产物被提交覆盖过一次而已)。Scope / Follow-ups / 范围与后续
GitHub Actions 中
pnpm run build→ 将cloud-functions/放入dist/→npx edgeone makers deploy ./dist -n openlist-tsworker -t ${{ secrets.EDGEONE_API_TOKEN }},并相应调整 README 的一键部署按钮说明。
tests/目前没有 CI 覆盖的现状(meta.test.ts等未被任何工作流执行)。Commits / 提交
1788357—build(edgeone): generate cloud-functions artifact at deploy time instead of committing it(20 files changed, +113 / −604)