4.8 KiB
4.8 KiB
Port site to Astro (site-2)
Date: 2026-11-01
Task
site/ is a static build output. Port it 1:1 to Astro in site-2/.
What site/ actually contains
The current site is a hand-written static site with a dark "jewel" design:
index.html— homepageproject/index.html— "The Project" pagedevices/index.html— generated device cards (fromdevices/status.json)assets/peacock-head.svg,assets/peacock-full.svg— inlined at runtimelogo-mark-dark.png— faviconscripts/gen-devices.py+.github/workflows/devices.yml— device pipelinevercel.json— static hosting config
It also contains stale leftovers from an older Next.js export (light
"builder design language" theme, branch origin/site-redesign-light):
404.html, 404/, _not-found/, _next/, index.txt, __next*.txt,
assets/site.css, assets/site.js. Nothing in the current pages references
them (only 404.html references _next). These were intentionally not
ported.
Git context: HEAD on master is commit 52064e2 ("Rework homepage copy …"),
which is the current dark site. The Next.js files date from commits
46e21d5/2679833/211fe75.
Astro structure
site-2/
astro.config.mjs static, build.format 'directory'
public/ favicon, devices/status.json, devices/img/
src/
assets/peacock-*.svg imported with ?raw and inlined at build time
components/
Header.astro homeHref prop (index uses "#", others "/")
Footer.astro
Mark.astro strips <?xml?>, fill:#xxx -> fill:currentColor
IridescentDefs.astro hidden SVG with the #irid gradient
layouts/Base.astro head/meta/fonts, ambient/grain, page wrapper, shared script
pages/
index.astro
project.astro
devices.astro renders from public/devices/status.json at build time
404.astro
scripts/site.js reveals + spine (mark inlining removed)
styles/global.css exact original <style> block from index.html
scripts/gen-devices.py trimmed: no longer emits devices/index.html
.github/workflows/devices.yml commits public/devices/ instead of devices/
Decisions
- Inline the peacock SVGs at build time (
?raw+ regex) instead of the original runtimefetch(). Same DOM/appearance, no network round-trip and no flash.data-markattributes are gone because they are no longer needed. - Shared CSS as a stylesheet. The original inlined the same
<style>on every page. Astro bundles it to/_astro/Base.*.css; rule set is identical (88 selectors, minifier only rewrites::after→:afterand media query range syntax). - Devices page is data-driven at build time rather than generated HTML.
devices.astroreadspublic/devices/status.json, reproduces the Python generator's grouping/platform/image/search logic exactly. The Python script now only writesstatus.json, images and the wiki. - 404 is new (in the dark design). The original
404.htmlwas the stale light Next.js page; porting it would have preserved a design bug. - Keep URLs identical:
/,/project,/devices,/404.html; external links unchanged; nav unchanged (devices is still not in the nav). assets/site.css/site.jswere dropped because no current page uses them.
Verification performed
- Structure/text: custom HTML parser diff (ignoring style/script/SVG/CSS
link/data-mark) →
IDENTICAL STRUCTURE/TEXTfor index, project, devices (268/245/225 nodes). - CSS: selector-set comparison → identical (88 global, 19 devices).
- Layout: Puppeteer
getBoundingClientRectfor every element at 1440×900, fonts awaited → 0 meaningful differences. (Found and fixed one real bug: an Astro HTML-compression whitespace drop before the "wiki" link on /devices.) - Pixels: full-page screenshots of both sites,
prefers-reduced-motion, same fonts → identical dimensions; zero pixels differ by more than 1%. - Interactions: reveals, spine fill (100% at bottom), mark paths, device search filtering, no-result message, project door count, 404 title; no console/page errors.
- Generator functions (
by_brand,platform,support_items,matrix_md,index_md) exercised against the realstatus.json.
Follow-ups / notes
public/devices/status.jsonis the single source for the devices page. The CI script writes it there (Astro copiespublic/as-is).site/still has its own.gitand is not tracked by this repo root (the root is not a git repo). Do not editsite/as part of the port.- If the design changes upstream in
site/, re-extract the<style>block tosrc/styles/global.cssand re-check page markup. - Screenshot/rect comparison scripts lived in
/tmp/opencodeand are not committed.