Skip to content

feat(cloudflare): support cf Build Output deployments - #3230

Merged
james-elicx merged 42 commits into
mainfrom
codex/apps-web-cf-v2
Sep 26, 2026
Merged

james-elicx merged 42 commits into
mainfrom
codex/apps-web-cf-v2

Conversation

@james-elicx

@james-elicx james-elicx commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Add an optional cf deployment path for vinext projects using cloudflare.config.ts and Cloudflare Vite plugin v2. Existing Wrangler projects keep their current deployment flow. apps/web uses cf@1.0.0-beta.1 and Cloudflare Vite plugin 2.0.0-beta.sha-805ec1ff3, and vinext init --experimental-cf generates the typed configuration and matching dependencies/scripts for new projects.

  • Use Cloudflare Build Output for version uploads, deployment-status reads, staged traffic, trigger deployment, warming, and promotion through cf.
  • Preserve the cacheability flow: probe the staged Worker, write the resulting manifest into the built Worker module, upload the final version, warm it, and promote it.
  • Configure Workers Cache and both Workers Response Store modes through helpers in @vinext/cloudflare; deploy named service-binding Workers with native cf deploy --worker before the application Worker.
  • Keep the selected Vite mode consistent across builds and cf commands, including the default production mode required for prebuilt deployments.
  • Generate binding and runtime types into ignored .cloudflare/types/ during install, dev, and build; keep them out of the PR. Select CI preview tooling by the presence of cloudflare.config.ts.

Validation

  • 202 targeted init and typed-configuration tests passed with the updated Vite plugin. Removing generated types and running a frozen install recreates them; apps/web type-checks against both CLI-generated and build-generated declarations.

  • 647 targeted init, deployment, RSC-plugin, and multi-stage build tests passed after merging current main.

  • All five generated init configurations build: App and Pages service-binding mode, self-contained Response Store, Workers Cache, and Pages without CDN caching.

  • Full apps/web build produces both the application and Response Store Workers; both pass cf deploy dry-runs.

  • Live Workers Cache deployment with the beta CLI completed discovery, manifest generation, final version upload, HTML/RSC warming (2/2), and promotion. Repeated HTML and RSC requests returned cache hits with stable response hashes; the dynamic control route bypassed cache and returned changing content.

  • Frozen-lockfile installation and targeted formatting, lint, and type checks passed.

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

@pkg-pr-new

pkg-pr-new Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vinext/cloudflare

npm i https://pkg.pr.new/@vinext/cloudflare@3230

create-vinext-app

npm i https://pkg.pr.new/create-vinext-app@3230

@vinext/types

npm i https://pkg.pr.new/@vinext/types@3230

vinext

npm i https://pkg.pr.new/vinext@3230

@cloudflare/workers-response-store

npm i https://pkg.pr.new/@cloudflare/workers-response-store@3230

commit: ca74a1a

@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor
Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original
response-store-demo preview production
workers-cache preview production
kv preview production
static-export preview production
web preview production

@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared ca74a1a against base 42d3ab9 using alternating same-runner rounds. Next.js was unchanged and skipped.

1 improved · 0 regressed · 5 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 142.3 KB 142.3 KB ⚫ -0.0%
Client entry size (gzip) vinext 130.4 KB 130.4 KB ⚫ -0.0%
Dev server cold start vinext 3.33 s 3.27 s 🟢 -1.8%
Production build time vinext 3.78 s 3.77 s ⚫ -0.3%
RSC entry closure size (gzip) vinext 128.2 KB 128.3 KB ⚫ +0.0%
Server bundle size (gzip) vinext 226.8 KB 226.8 KB ⚫ +0.0%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

Comment thread packages/cloudflare/src/deploy.ts
@ask-bonk

ask-bonk Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Posted 1 inline finding.

Validation: 456 focused tests passed; apps/web Build Output completed successfully.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Comment thread packages/cloudflare/src/deploy.ts
Comment thread packages/cloudflare/src/deploy.ts Outdated
Comment thread packages/cloudflare/src/deploy.ts Outdated
Comment thread packages/cloudflare/src/deploy.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Posted 4 inline findings.

Validation: 456 focused tests passed; apps/web Build Output and cf --prebuilt --dry-run succeeded.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

@ask-bonk

ask-bonk Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

@james-elicx Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues. The workflow has a hard 10-minute timeout including setup. Prioritize actionable correctness findings, stop analysis early enough to post the verdict, and return the best completed review within the available time even if coverage is not exhaustive.

Comment thread packages/cloudflare/src/version-deploy.ts
@ask-bonk

ask-bonk Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please review exact head 632dfb83e0f0ff74030c0633b85579123426da73. You have a 10-minute time limit; please post the most important actionable findings you can complete within that window rather than timing out without a result.

Comment thread packages/cloudflare/src/deploy.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding.

github run

);
writeFileSync(
path.join(plugin, "config.js"),
`export const bindings = { versionMetadata: () => ({ version: ${JSON.stringify(version)} }) };
writeFileSync(
path.join(plugin, "config.js"),
`export const bindings = { versionMetadata: () => ({ version: ${JSON.stringify(version)} }) };
export const exports = { worker: () => ({ version: ${JSON.stringify(version)} }) };`,
Comment thread packages/cloudflare/README.md Outdated
@james-elicx
james-elicx marked this pull request as ready for review September 26, 2026 21:41
@james-elicx
james-elicx merged commit 63baa24 into main Sep 26, 2026
80 checks passed
@james-elicx
james-elicx deleted the codex/apps-web-cf-v2 branch September 26, 2026 21:41
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.

2 participants