zudo-doc
GitHub repository

Type to search...

to open search from anywhere

Development Workflow

Created Apr 13, 2026Updated Jun 21, 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 the zfb dev server (port 4321) and doc-history-server (port 4322) concurrently
pnpm dev:zfbzfb dev server only (port 4321)
pnpm dev:historyDoc history API server only (port 4322)
pnpm dev:zudo-doctsup --watch for the @takazudo/zudo-doc package
pnpm dev:stableAlternative build-then-serve mode (avoids HMR crashes on content file add/remove)
pnpm dev:networkzfb 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 checkTypeScript type checking
pnpm b4pushPre-push validation: 19-step pipeline (format check → ... → build → link check → HTML validation → preview smoke); E2E is parked
pnpm formatFormat MDX 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 and all links resolve. It runs 19 steps (format check through preview smoke); E2E tests are intentionally parked and not part of this pipeline.

The canonical, authoritative b4push step list lives in the header comment of scripts/run-b4push.sh — treat that script as the single source of truth, and consult it rather than any inline summary if the steps appear to disagree.

Component Development

zudo-doc is a Preact-only project running on zfb. All components are .tsx files. The distinction is whether a component runs only on the server, or also hydrates on the client.

Server-rendered Preact components

By default, every .tsx component renders to HTML at build time and ships zero client-side JavaScript. This is the right choice for:

  • Layout wrappers

  • Static UI elements (headers, footers, sidebars without interactivity)

  • Anything that doesn't require runtime state or DOM events

Client-hydrated islands

When a component needs interactivity — local state, event handlers, animations — it registers itself with zfb's island runtime through its own useEffect / event-binding code. Server-render output is reused; only the interactive part hydrates.

Current islands in the project: toc.tsx, mobile-toc.tsx, sidebar-toggle.tsx, sidebar-tree.tsx, theme-toggle.tsx, doc-history.tsx, zdtp panel (Design Token Panel — self-mounted via configurePanel() from the @takazudo/zdtp package, not registered in the island registry), ai-chat-modal.

Use client-hydrated 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 that render purely on the server — no client hydration. They override standard HTML elements in MDX via the _mdx-components.ts mapping consumed by the doc page route.

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 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

Takeshi TakatsudoCreated: 2026-04-13T21:31:38+09:00Updated: 2026-06-21T20:25:54Z

AI Assistant

Ask a question about the documentation.