zudo-doc
GitHub repository

Type to search...

to open search from anywhere

Development Workflow

CreatedApr 27, 2026Takeshi Takatsudo

Development commands, build tools, and component development patterns for zudo-doc.

Development Commands

These commands start the local development servers.

CommandWhat it does
pnpm devRuns Astro dev server (port 4321) and doc-history-server (port 4322) concurrently
pnpm dev:astroAstro dev server only (port 4321)
pnpm dev:historyDoc history API server only (port 4322)
pnpm dev:stableAlternative build-then-serve mode (avoids HMR crashes on content file add/remove)
pnpm dev:networkAstro dev server with --host 0.0.0.0 for LAN access

πŸ’‘ Tip

Use pnpm dev:stable when you’re adding or removing content files frequently. Standard pnpm dev can crash on file system changes due to Vite HMR.

Build & Quality Commands

CommandWhat it does
pnpm buildStatic HTML export to dist/
pnpm checkAstro type checking
pnpm b4pushPre-push validation: format check β†’ typecheck β†’ build β†’ link check β†’ E2E tests
pnpm formatFormat MDX and Astro files
pnpm test:unitRun unit tests (Vitest)
pnpm test:e2eRun E2E tests (Playwright)

πŸ“ Note

Run pnpm b4push before pushing to verify the full site builds, all links resolve, and E2E tests pass. This catches broken cross-doc links and TypeScript errors that the dev server tolerates.

Component Development

zudo-doc uses three component tiers. Choose the right tier based on what your component needs to do.

Astro Components

.astro files are the default choice β€” zero JavaScript, server-rendered at build time.

Use Astro components for:

  • Layout wrappers
  • Static UI elements (headers, footers, sidebars)
  • Anything that doesn’t require user interaction

Preact Islands

client:load islands are used only when client-side interactivity is required. Preact runs in compat mode (@astrojs/preact with compat: true), so components can use React-style imports and APIs.

Current islands in the project: toc.tsx, mobile-toc.tsx, sidebar-toggle.tsx, sidebar-tree.tsx, theme-toggle.tsx, doc-history.tsx, color-tweak-panel.tsx, color-tweak-export-modal.tsx.

Use Preact islands for:

  • Scroll spy (TOC highlighting)
  • Toggle/drawer components
  • Live editing panels

Content Typography Components

These live in src/components/content/ and are Preact function components without a client: directive β€” they are server-rendered with zero client JavaScript. They override standard HTML elements in MDX via <Content components={...} />.

Current overrides: headings (h2–h4), paragraph, link, strong, blockquote, lists (ul/ol), table.

Use content typography components when you need to apply project design tokens to standard MDX prose elements.

Content Development Cycle

Follow these steps when adding new documentation pages:

  1. Create a .mdx file under src/content/docs/ with title and sidebar_position in the frontmatter.
  2. Write content starting with ## h2 headings. Do not add # h1 β€” the frontmatter title renders as the page h1.
  3. Create a matching file under src/content/docs-ja/ with translated prose.
  4. Keep all code blocks identical between EN and JA β€” only translate the surrounding prose.
  5. Run pnpm format:mdx to format MDX files.
  6. Run pnpm build to verify the site builds correctly.

πŸ’‘ Tip

Always set sidebar_position in frontmatter. Without it, pages sort alphabetically, which is rarely the intended order.

See the Frontmatter reference for all available frontmatter fields.

Revision History

AI Assistant

Ask a question about the documentation.