Migrate docs-sip to Vercel: client-side Mermaid + deploy config - #95
Merged
Conversation
rehype-mermaid's img-svg strategy renders diagrams to SVG at build time using a headless Chromium. Vercel's build image can't launch it (missing libnspr4.so and other system libs), so the build fails. Switch to the 'pre-mermaid' strategy, which emits <pre class="mermaid"> blocks, and render them in the browser via a Starlight <Head> override. The renderer is theme-aware (MutationObserver on data-theme), view-transition-safe (astro:page-load), and lazy (mermaid loads only on pages with a diagram). Add mermaid as a direct dependency for the client render. playwright is retained because mermaid-isomorphic imports it at module load even under pre-mermaid; it is never launched.
Pin the build to 'npm run build' so the docs:api TypeDoc step runs (Astro's framework default would skip it), and skip Playwright's browser download at install time. .vercelignore excludes the build output and the TypeDoc-generated reference dir, both regenerated during the build.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Adding mermaid via local npm 11 (node 24) rewrote the lock file so that CI's strict 'npm ci' under npm 10 (node 20) rejects it — npm 10 resolves ws@8.21.0 as its own entry. Regenerated with npm 10 so the lock file is in sync for 'npm ci'. Follow-up: align node/npm across local, CI, and Vercel to prevent recurrence.
rz1989s
force-pushed
the
fix/vercel-mermaid-client-render
branch
from
May 31, 2026 02:46
8619ac3 to
f233813
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prepares docs-sip for Vercel hosting (migrating off VPS reclabs3).
Problem
The build renders Mermaid diagrams to SVG at build time via rehype-mermaid's
img-svgstrategy, which launches a headless Chromium (Playwright). Vercel's build image can't launch it —libnspr4.so: cannot open shared object file(other Chromium system libs are missing too, with no apt to install them). Build fails.Fix
pre-mermaidstrategy → emits<pre class="mermaid">and renders client-side in the browser.<Head>override (src/components/Head.astro) runs the client renderer: theme-aware (re-renders on light/dark toggle via a MutationObserver), view-transition-safe (astro:page-load), and lazy (loadsmermaidonly on pages with a diagram).mermaidadded as a direct dep;playwrightretained (mermaid-isomorphic imports it at module load even under pre-mermaid) but never launched, and its browser download is skipped on Vercel.Deploy config
vercel.json: pins build tonpm run build(so thedocs:apiTypeDoc step runs — Astro's default would skip it) and skips the Playwright browser download at install..vercelignore: dropsdist/and the generatedreference/from the upload.Validation (Vercel preview)
DNS cutover (docs.sip-protocol.org → Vercel) follows after merge.