Skip to content

Migrate btcr2.dev to Astro Starlight (v2.0.0) - #4

Merged
jintekc merged 3 commits into
mainfrom
astro-starlight
Sep 4, 2026
Merged

jintekc merged 3 commits into
mainfrom
astro-starlight

Conversation

@jintekc

@jintekc jintekc commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR replaces the VitePress site with Astro Starlight and bumps the site to version 2.0.0. The page content, the Vue demo components, and the same-origin /mempool proxy contract do not change.

Commits: the migration (61a3402), a sync merge with main v1.1.1 (c769795), and a sync merge with the CI fix on main (7eef545).

Why

  • Smaller pages. VitePress hydrates one Vue application on every page, and the theme registered the demo components globally. Prose pages shipped about 95 KB of gzipped script. With Astro islands, prose pages ship about 5 KB, and the @did-btcr2 browser bundle loads only on the demo page.
  • Less custom code. The VitePress build carried a markdown-it fence override plus a custom Mermaid.vue component for diagrams, a theme entry that registered every component, TypeScript shims, and a custom CSS file. Starlight and astro-mermaid cover the same needs, so that code is deleted.
  • Framework-agnostic demos. Islands can mix frameworks. The demos stay Vue today. Demos for other implementations can use other frameworks or none.
  • Faster builds. The production build takes about 2.5 s instead of 9.5 s.
  • Version 2.0.0. The build output path moves from docs/.vitepress/dist to dist/. That is a packaging-visible change, so the version gets a major bump.

What changed

  • Framework: Astro 7 + Starlight 0.41 + @astrojs/vue + astro-mermaid. Config lives in astro.config.mjs (sidebar, social links, custom CSS, Vite /mempool dev proxy).
  • Content moved from docs/ to src/content/docs/. Pages that import components are .mdx (index.mdx, demo.mdx, impls/ts.mdx). All other pages are plain .md. Starlight takes the page title from frontmatter, so pages have no H1 in the body.
  • Demos are Vue islands. The components under src/theme/ are unchanged. demo.mdx mounts them with client:only="vue", so they never render on the server.
  • Mermaid fences render client-side through astro-mermaid, registered before starlight in the integrations list. The order matters. Diagram sources stay inline in the markdown. The standalone OKR sources move from docs/public/diagrams/okrs/ to public/diagrams/okrs/.
  • TS examples moved to src/examples/ts/. impls/ts.mdx embeds them with ?raw imports and the Starlight <Code> component. astro check typechecks them, so they must stay self-contained.
  • Styles: src/styles/custom.css aliases the --vp-c-* variables that the demo components still use to the Starlight --sl-color-* palette.
  • Search: Starlight's built-in Pagefind index replaces the VitePress local search provider.
  • Packaging: rpm/btcr2-dev.spec is at Version: 2.0.0 and installs dist/*.
  • Scripts: pnpm dev, pnpm build, pnpm preview, and pnpm typecheck (now astro check) keep their names. pnpm clean wipes .astro and dist.
  • CLAUDE.md rewritten for the new layout.

What stays the same

  • The three @did-btcr2 packages and their version ranges.
  • The same-origin /mempool proxy contract. In dev, the Vite proxy in astro.config.mjs forwards /mempool to mempool.space. In production, the web server must provide the same reverse proxy, for example nginx location /mempool/ { proxy_pass https://mempool.space/; }. Direct browser calls fail: the @did-btcr2/bitcoin REST client sends Content-Type: application/json on GET requests, and mempool.space rejects the resulting CORS preflight.
  • All page URLs. Astro emits directory-style output (demo/index.html), so the old /demo links resolve without rewrites.

Verification

  • pnpm typecheck (astro check): 0 errors, 0 warnings, 1 hint.
  • pnpm build: 11 pages. Pagefind index and sitemap created.
  • Fresh npm install && npm run build, the recipe in rpm/btcr2-dev.spec, on Node 24: green, TypeScript 5.9.3 resolved.
  • Node smoke test on mutinynet: k1 and x1 create, x1 sidecar resolve. PASS on api 0.17.0 / common 9.1.0 / keypair 0.13.1.

Review focus

  1. astro.config.mjs: sidebar structure, integration order, the /mempool proxy block.
  2. src/content/docs/demo.mdx and impls/ts.mdx: the hand-ported MDX prose and the ?raw example embeds.
  3. src/styles/custom.css: the --vp-c-* alias block. Do not remove it.
  4. rpm/btcr2-dev.spec: output path and changelog entry.
  5. Run pnpm dev and try Create, Resolve, and Update on mutinynet and testnet4.

Out of scope

  • Dependency bumps (@did-btcr2/api 0.19.x, @did-btcr2/common 9.3.x, Astro 7.3, Starlight 0.42). Separate PRs, after the demos are re-tested on a test network.

jintekc added 3 commits July 17, 2026 15:11
Port the x1 demo fix (59bc022) into the Astro layout: git rename
detection applied the Create/Resolve/Update.vue changes and the new
errors.ts under src/theme/demos/; the demo.md prose changes were
hand-ported into src/content/docs/demo.mdx in its colon style.
Version stays 2.0.0; the 1.1.1 changelog entry is preserved beneath
2.0.0 in rpm/btcr2-dev.spec. pnpm-workspace.yaml comes along from main.

Verified: astro check + astro build green (11 pages); Node smoke
against mutinynet passes (k1 create, x1 create via
GenesisDocument.fromPublicKey + canonicalHashBytes, x1 resolve with
sidecar genesisDocument).
@jintekc
jintekc merged commit 334dc53 into main Sep 4, 2026
1 check passed
@jintekc
jintekc deleted the astro-starlight branch September 4, 2026 20:04
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