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.