pcbjam/CLAUDE.md
Viktor Vaczi 7edfade53c feat(site): move the marketing site from Vercel to Cloudflare Pages
www.pcbjam.com was the last piece of the stack on Vercel. It is now a
Cloudflare Pages project (pcbjam-site) deployed by deploy-site.yml on
every push to main touching site/** — content must not wait for a
release tag.

The Astro adapter is gone entirely: the build is pure static and the one
dynamic route, /api/waitlist, is a Pages Function. Going adapter-free
(rather than swapping in @astrojs/cloudflare, which has dropped Pages
support and only targets Workers) removes three problems at once — no
Astro/adapter major-version coupling, Footer.astro's build-time execSync
keeps working because prerendering stays in Node, and image optimisation
stays plain build-time sharp with no Cloudflare Images binding.

Verified against a real Pages runtime (wrangler pages dev): 21/21 parity
probes pass, versus 19/21 on live Vercel. The scripted runbook is in
deploy/site/ — every mutating step is dry-run by default.

Four behaviour differences were found by measurement and are handled here:

- The blog post's COOP/COEP was already broken in production. vercel.json
  scoped the headers to the bare URL, but the page's own canonical is the
  trailing-slash form, which served 200 with no isolation headers — so
  search arrivals lost SharedArrayBuffer and the embedded Gerber viewer
  degraded. public/_headers covers both forms.

- Pages answers unknown URLs with the homepage at HTTP 200 when the
  output has no 404.html — a soft-404 that invites indexing junk URLs as
  the homepage. Hence src/pages/404.astro.

- Vercel's edge refused cross-site form POSTs ("Cross-site POST form
  submissions are forbidden"); Pages does not, and a cross-site <form>
  submit needs no CORS permission to be sent, so the allowlist cannot
  stop it. The Function reproduces the guard; JSON posts stay exempt as
  that is demo.pcbjam.com's allowlisted path.

- Cache-Control: immutable on /_astro/* came from the Vercel adapter's
  generated route config, so it is now an explicit _headers rule.

Secrets move to `wrangler pages secret put --project-name pcbjam-site`
(RESEND_API_KEY, RESEND_SEGMENT_ID, WAITLIST_FROM_EMAIL);
WAITLIST_ALLOWED_ORIGINS stays unset so the allowlist stays in code.
Local dev reads .dev.vars, now gitignored — the root repo's **/.dev.vars
does not cover a nested git repo.

privacy.md and cookies.md named Vercel as a GDPR Art. 28 processor; those
mentions are removed and the existing Cloudflare entry widened to cover
website hosting.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LAmkjM7okPdScp9XLW1JVr
2026-07-27 13:41:51 +02:00

3.4 KiB

The goal is to build kicad with wasm and run it in a browser README.md details how to run the project

A lot of native module have to be compiled to wasm, the most complex is wxwidgets /kicad and /wxwidgets are git submodules from our own forks The e2e tests are in /tests, with a README and WHATWORKS md files Test determinism rules (no blind sleeps/ifs, stableShot screenshots, retries:0) are in tests/TESTING.md, enforced by npm run lint:determinism. The e2e tests are separated per feature Wxwidgets wasm port has hooks for finding positions of UI elements, tests use that The test screenshots are tracked with git, per engine (tests/baseline-screenshots/{chromium,firefox}/); CI's Linux render is the source of truth (tooling: tests/tools/screenshots/, see its README). To update baselines, promote a CI run's render (churn-free — only meaningfully-changed images restage): cd tests && npm run screenshots:promote -- --run <ci-run-id>, then commit. npm run screenshots:check is the local gate; on each main push CI posts a screenshot-diff + runtime-perf report to Discord. The tests have log files in tests/logs/{wxwidgets/kicad}/{test-name} after each run where the js console and cpp logs are visible Always check screenshots for validating tests Run e2e tests from /tests folder: npm run test:e2e (full CI project set, one merged playwright.config.ts) or npm run test:kicad (firefox shortcut) — not playwright directly. One spec/engine: npx playwright test --project=kicad-firefox kicad/pcbnew.spec.ts. Web-app suite: npm run test:web.

Build kicad with docker/build.sh (includes wxwidgets build, runs in docker) Build wxwidgets standalone with scripts/build-wx-wasm.sh (runs on machine, for wxwidgets-only changes) Build CPP wxwidgets tests with scripts/builds-wasm-test.sh The build scripts pipe their outputs into log files so that they won't clog the LLM context. Don't pipe outputs, just run the scripts. Maybe with flex if you need that.

Don't change the wxwidgets core unless absolutely necessary, try to fix things in the wasm layer. Don't change kicad unless absolutely necessary - keep our fork as close to upstream as possible. Run scripts/kicad-diff-stats.sh to see how far our KiCad fork has diverged from upstream. It's okay to add temporary logging that will be removed for debugging.

Don't try to guess what's broken , use debug tools / symbols, supported by the build scripts

Feature docs/patches are in features//. Run scripts/create-feature-patches.sh to save patches for root, kicad, wxwidgets submodules.

The landing page / website is in /site (Astro, static, deployed to Cloudflare Pages by .github/workflows/deploy-site.yml on every push to main touching site/**). It has no Astro adapter; the one dynamic route (/api/waitlist) is a Cloudflare Pages Function in site/functions/. Prod response headers come from site/public/_headers (COOP/COEP for the embedded Gerber viewer — never widen them to /*, the landing page must stay un-isolated for the YouTube embed). The footer shows a build SHA that links to the pcbjam commit the site was built from; because it pins the kicad + wxwidgets submodule revisions implicitly, it is our GPLv3 corresponding-source pointer (see /licenses). It resolves automatically at build time in site/src/components/Footer.astro (CF_PAGES_COMMIT_SHA / GITHUB_SHA in CI, git rev-parse locally) — no manual bump needed. The Cloudflare setup + cutover runbook is in pcbjam/deploy/site/README.md.