Skip to content

Move the docs to React, Vite and Tailwind 4 - #3

Merged
lnsp merged 2 commits into
masterfrom
move-to-react-vite
Nov 20, 2026
Merged

lnsp merged 2 commits into
masterfrom
move-to-react-vite

Conversation

@lnsp

@lnsp lnsp commented Nov 20, 2026

Copy link
Copy Markdown
Member

This moves docs.valar.dev from docsify to the console's stack: React 19, TypeScript, Vite 8, React Router 8 and Tailwind CSS 4. The Markdown files are still the source of truth. They moved into content/ as pure renames, so their history follows, and their text is unchanged.

What changed

  • Markdown at build time. A small Vite plugin (src/markdown/) renders each page with marked and highlights code with Shiki, so the client bundle carries no Markdown parser or highlighter. The plugin also:
    • rewrites links between pages (api/builds.md becomes /api/builds);
    • gives headings the same ids docsify did;
    • renders GitHub tables and GitHub alerts (> [!TIP]). The content had no docsify ?>/!> callouts, so no content edits were needed.
  • Navigation. The sidebar is still built from content/_sidebar.md, which remains the only place to register a page. The layout follows the console's: a dark sidebar with grouped links, a menu button at phone width, and previous/next links below each page.
  • Static HTML per page. npm run build runs the client build, a server build and scripts/prerender.js. The prerender writes dist/<path>/index.html for each page: 25 files, including /.
    • Each page's content is in its HTML, so it reads without JavaScript.
    • The client hydrates that HTML, and fetches other pages' content as small chunks.
  • URLs.
    • Pages live at clean paths (/getting-started/cli-setup), and / shows the homepage as before.
    • Old docsify links (/#/api/builds?id=list-builds) redirect from / to /api/builds#list-builds.
  • Deployment. .valar.yml switches from static to node-static, whose defaults (npm install, npm run build, serve dist/) work as they are. Optionally, INSTALL_CMD="npm ci --no-audit --no-fund" can be set later in the environment store (valar env set --build ...).
  • Removed: the docsify index.html, vue.css and img/. The brand tokens, the self-hosted Inter and JetBrains Mono fonts, the favicon and the logo now come from the console.

Verification

  • npm ci && npm run lint && npm run typecheck && npm test && npm run build pass. There are 39 tests:
    • Every sidebar entry, link and heading anchor in content/ resolves.
    • The renderer: link rewriting, heading ids, highlighting, tables, alerts.
    • The docsify hash mapping.
    • The prerender writes one index.html per page plus /.
    • The UI: current page, client-side links, previous/next, phone menu, not-found page.
  • I served dist/ with a files-only server (python3 -m http.server -d dist) and checked it in Chromium:
    • All 25 routes load, including reloads on deep links.
    • An unknown path returns 404.
    • Old hash links redirect.
    • Navigation from the sidebar and from in-page links stays client-side.
    • There are no console errors.
  • Heading ids and page titles match the live docsify site on all 24 pages.
  • I compared screenshots of the live site and the build at 1280 and 390 px wide. The content and structure are the same. The look follows the console: dark sidebar, Inter, and highlighted code with no language label.
  • dist/ is 2.6 MB, 1.4 MB of which is the Inter TTFs. The main script is 268 kB (84 kB gzipped). Each page's content chunk is 0.4 to 13 kB.

CLAUDE.md and a CI workflow follow in a stacked PR.

The site now uses the console's stack: React 19, TypeScript, Vite 8,
React Router 8 and Tailwind CSS 4. The Markdown files move unchanged
into content/, and content/_sidebar.md still lists the pages.

A Vite plugin renders the Markdown at build time with marked and
highlights code with Shiki, so the client carries no Markdown parser.
It rewrites links between pages to clean paths and keeps docsify's
heading ids. The build prerenders every page to dist/<path>/index.html
for the files-only nginx runtime, and / redirects old docsify hash
links to the new paths.

.valar.yml switches to the node-static constructor.
The agent instructions now cover the React and Vite setup, the
commands, where the pages and the sidebar live, and how to add a page.
A check workflow, copied from the console, runs lint, typecheck, tests
and build on pull requests.
@lnsp
lnsp merged commit faac563 into master Nov 20, 2026
1 check passed
@lnsp
lnsp deleted the move-to-react-vite branch November 20, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant