From 32d39d14fd76ce4b71f93de603f9e655a6ad0b9f Mon Sep 17 00:00:00 2001 From: okcodes <80954089+okcodes@users.noreply.github.com> Date: Sun, 6 Sep 2026 07:11:54 -0600 Subject: [PATCH] add pnpm preview:website to test the prerendered build locally dev:website runs Vite's dev server, which never runs the SSR/prerender step - #root starts empty there and only the client render fills it in. There was no easy way to see or debug the actual prerendered HTML a crawler or no-JS client gets without deploying. preview:website builds (prerender step included) and serves the real dist/ output with Vite's own preview server - a plain build-then-serve, no watch/hot-reload, since that would mean rebuilding on every change (tsc + two vite build passes + the prerender script) for a workflow reached for occasionally rather than run all day like dev:website. Co-Authored-By: Claude Sonnet 5 --- README.md | 4 ++++ package.json | 2 ++ website/README.md | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/README.md b/README.md index d71f982..918fc26 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,10 @@ pnpm dev:website # Build the public website pnpm build:website +# Build the public website and serve the real static output (what CI deploys, +# prerendered HTML included) - no hot reload, refresh manually after a change +pnpm preview:website + # Pull a @codehacks/virtual-console release into the website (see Releasing below) pnpm bump:website:latest ``` diff --git a/package.json b/package.json index b7031ad..69deff3 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,8 @@ "build:published": "pnpm run build:import:published && pnpm run build:vite-plugin:published", "build:website": "pnpm run install:website && pnpm --dir website build", + "preview:website": "pnpm run build:website && pnpm --dir website preview", + "install:import:published": "pnpm --dir examples/published/react-vite-import install", "install:vite-plugin:published": "pnpm --dir examples/published/react-vite-plugin install", "install:published": "pnpm run install:import:published && pnpm run install:vite-plugin:published", diff --git a/website/README.md b/website/README.md index 12cb440..5b3b38c 100644 --- a/website/README.md +++ b/website/README.md @@ -10,13 +10,25 @@ Standalone project (own `pnpm-workspace.yaml`), same reasoning as `examples/publ # from the repo root pnpm dev:website pnpm build:website +pnpm preview:website # build + serve the real static output (dist/), prerendered HTML included # or directly cd website pnpm install pnpm dev +pnpm build && pnpm preview ``` +`pnpm dev` (Vite's dev server) never runs the prerender step - `index.html`'s `#root` starts empty +there and `main.tsx` client-renders into it (see [DECISIONS.md](../DECISIONS.md)). To see and debug +the actual prerendered HTML a no-JS client or crawler would get - or to check something that only +happens in the production build - use `preview:website` (or `pnpm build && pnpm preview` from +`website/`) instead. It's a plain build-then-serve, not a dev server: no hot reload or watch mode, +so re-run it after each change. That's a deliberate simplicity trade, not a limitation to fix - +wiring up a watcher for a full rebuild (`tsc` + two `vite build` passes + the prerender script) on +every change would add real complexity for a workflow that's normally reached for occasionally, not +kept running all day like `pnpm dev`. + ## Deployment Deployed to GitHub Pages by `.github/workflows/release-website.yml`, independently of the package's own release line - a `website-v{version}` tag deploys the website; a plain `v{version}` tag (the package release) does not. This is its own [vump](https://github.com/okcodes/vump) project (`website` in the root `vump.toml`, tracking this directory's `package.json`), so a site-only change ships with `vump patch --project website --tag --push` and never touches the package's version or npm. See [DECISIONS.md](../DECISIONS.md) for the full reasoning.