Skip to content

feat(viewer): deploy to Cloudflare Workers; add graphs companion site#246

Merged
jamesdabbs merged 2 commits into
mainfrom
feat/cloudflare-workers
Jun 28, 2026
Merged

feat(viewer): deploy to Cloudflare Workers; add graphs companion site#246
jamesdabbs merged 2 commits into
mainfrom
feat/cloudflare-workers

Conversation

@jamesdabbs

Copy link
Copy Markdown
Member

What

Migrates the viewer deployment from Cloudflare Pages → Cloudflare Workers
(Static Assets), and adds a second build flavor for a graphs.pi-base.org
companion site. Both Workers are built from this one repo, selected at build
time by a VITE_SITE flag.

Already deployed and verified on *.workers.dev:

Changes

  • Bump @sveltejs/adapter-cloudflare 3 → 7 (one adapter now handles both Pages
    and Workers; adapter-cloudflare-workers is deprecated), add wrangler 4.
  • packages/viewer/wrangler.jsonc: Workers Static Assets config with
    topology/graphs named environments (→ pi-base-topology/pi-base-graphs).
  • src/site.ts: VITE_SITE flavor; Nav.svelte renders the brand from it.
  • bin/build: read WORKERS_CI_* (Workers Builds) with CF_PAGES_*/git fallback.
  • cf:deploy:* / cf:preview:* npm scripts for Workers Builds.
  • doc/deployment.md: document the Workers Builds CI setup.

Safe alongside the existing Pages site

The legacy Pages deploy keeps working with this branch merged. Cloudflare sets
CF_PAGES=1 during Pages builds, and @sveltejs/adapter-cloudflare checks that
first (is_building_for_cloudflare_pages), so a Pages build still emits Pages
output (_routes.json, no .assetsignore) even with wrangler.jsonc present —
verified locally by building both ways. v7 is the officially supported Pages
adapter, so the 3 → 7 bump is supported on the Pages path too.

Pre-merge check: pushing this branch generates a Pages preview deployment
— confirm that preview renders before merging to validate the v7 Pages output on
the real project.

Out of scope (follow-up)

Custom domains (graphs.pi-base.org; cutting topology.pi-base.org over from
Pages), full branding parametrization, the real graphs data bundle, and
cypress/e2e preview-URL updates. Pages can be decommissioned after the cutover.

Test plan

  • pnpm --filter core build then VITE_SITE=topology|graphs pnpm --filter viewer build
  • pnpm --filter viewer exec wrangler dev/ 200, assets served, brand differs
  • pnpm --filter viewer run test (61 pass)

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 27, 2026

Copy link
Copy Markdown

Deploying topology with  Cloudflare Pages  Cloudflare Pages

Latest commit: b823278
Status: ✅  Deploy successful!
Preview URL: https://1cc369a6.topology.pages.dev
Branch Preview URL: https://feat-cloudflare-workers.topology.pages.dev

View logs

Migrate the viewer from Cloudflare Pages to Cloudflare Workers (Static
Assets) and add a second build flavor for a graphs.pi-base.org companion,
selected at build time via VITE_SITE.

- Bump @sveltejs/adapter-cloudflare 3 -> 7 (one adapter handles both Pages
  and Workers; adapter-cloudflare-workers is deprecated); add wrangler 4
- Add packages/viewer/wrangler.jsonc with topology/graphs named envs
- Add src/site.ts (VITE_SITE flavor) and render the nav brand from it
- Update bin/build to read WORKERS_CI_* (CF_PAGES_*/git fallback)
- Add cf:deploy:* / cf:preview:* scripts for Workers Builds
- Document the Workers Builds CI setup in doc/deployment.md

The existing Pages deploy is unaffected: Pages sets CF_PAGES=1, which the
adapter checks first to keep emitting Pages output.
@jamesdabbs jamesdabbs self-assigned this Jun 28, 2026
@jamesdabbs jamesdabbs force-pushed the feat/cloudflare-workers branch from 4420d85 to 20aa9e4 Compare June 28, 2026 00:16
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
pi-base-graphs b823278 Commit Preview URL

Branch Preview URL
Jun 28 2026, 12:31 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
pi-base-topology b823278 Commit Preview URL

Branch Preview URL
Jun 28 2026, 12:31 AM

…opology

- bin/build: only `npm install -g pnpm` when pnpm is missing. Workers
  Builds already provides pnpm (via .tool-versions), so the unconditional
  global install errored with EEXIST and reinstalled deps redundantly.
- wrangler.jsonc: enable observability for the topology env so the
  production site's Worker Logs persist (queryable in the dashboard / API).
@jamesdabbs jamesdabbs merged commit 048b6d8 into main Jun 28, 2026
4 of 5 checks passed
@jamesdabbs jamesdabbs deleted the feat/cloudflare-workers branch June 28, 2026 00:33
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.

1 participant