Skip to content

Commit d57dc21

Browse files
authored
feat(docs): migrate component documentation to Fumadocs MDX (#20)
* refactor(repo): scaffold Turborepo monorepo structure Phase 1 of Fumadocs migration: - Move entire app into apps/docs/ - Add Turborepo config with dev/build/lint tasks - Add packages/config with shared tsconfig.base.json - Add pnpm workspace config - Create root package.json with workspace scripts - Rename docs package to @jalco/docs - Update husky for monorepo paths - Verify build passes from new location * feat(docs): add Fumadocs MDX infrastructure Phase 2 of migration: - Install fumadocs-core 16.6, fumadocs-mdx 14.2, fumadocs-ui (base-ui 16.6) - Upgrade to Next.js 16.2, React 19.2, Zod 4 - Add source.config.ts for MDX collection definition - Add lib/source.ts with Fumadocs page source loader - Add mdx-components.tsx with Fumadocs defaults - Wire createMDX into next.config.ts - Create content/docs/ with meta.json sidebar ordering for all 28 components - Create initial MDX pages: index.mdx, components/index.mdx - Add fumadocs-mdx:collections path mapping to tsconfig - Exclude .source/ from ESLint, suppress ignored-file warnings in lint-staged - All 42 existing pages still build alongside Fumadocs * feat(registry): add registry index generation for ComponentPreview Phase 3: registry index for Fumadocs ComponentPreview, getRegistryComponent helper, build pipeline wiring. Registry stays at registry/ — zero breakage. * feat(docs): add Fumadocs catch-all route for MDX pages Add app/docs/[...slug]/page.tsx that renders MDX content from content/docs/ via Fumadocs. Explicit TSX pages take priority — the catch-all only serves pages without a TSX counterpart. This enables gradual migration: delete a TSX page, create the MDX, and it works automatically. * fix(docs): update sitemap to include Fumadocs MDX pages Sitemap now merges routes from both the existing nav structure and Fumadocs page source, deduplicating. As TSX pages are migrated to MDX, the sitemap stays complete automatically. * fix(docs): fix CodeBlockCommand hydration mismatch on React 19.2 Initialize package manager state with server-safe default, then sync from localStorage in useEffect. The previous useState initializer read localStorage during SSR which caused hydration mismatches with React 19.2 / Next 16. * feat(docs): first MDX component page — status-indicator Prove the Fumadocs MDX pipeline end-to-end: - ComponentPreview + ComponentPreviewClient for rendering in MDX - InstallBlock wrapping existing InstallCommand - Example components in registry/status-indicator/examples/ - Auto-discover examples in build-registry-index script - status-indicator.mdx replaces the TSX page - All 42 pages build successfully * feat(docs): register all components as MDX components, full-fidelity status-indicator MDX - Register all 28 registry components + docs infrastructure as MDX components - Rewrite status-indicator.mdx to use ComponentDocsPage, VariantGrid, CodeLine, ApiRefTable — identical quality to the old TSX page - Fix export names: StepperItem, LogViewerTerminal/Minimal/Filterable, TipJar variants - Pattern proven: MDX pages can use the full docs component system with zero quality loss * feat(docs): convert commit-graph and color-palette to proper MDX Establish the correct MDX pattern: - Example files in registry/<name>/examples/ for each preview - Clean MDX with ComponentPreview, markdown code blocks, ApiRefTable - No template literals or TypeScript in MDX body - status-indicator, commit-graph, color-palette all working as MDX - 25 TSX pages remaining to convert * feat(docs): convert testimonial, logo-cloud, commit-graph, color-palette to MDX 4 components fully converted with example files + clean MDX. 24 TSX pages remaining. * feat(docs): convert all 28 component pages to MDX All TSX component docs pages are now MDX files in content/docs/components/. Each uses ComponentPreview with the existing preview files — no new example files needed for most components. Detailed examples exist for status-indicator, commit-graph, color-palette, testimonial, and logo-cloud. - 28 MDX files in content/docs/components/ - 0 TSX component pages remaining - Registry index auto-discovers preview files as ComponentPreview targets - All 41 pages build successfully - Playground files restored to components/docs/playgrounds/ * feat(docs): switch sidebar to Fumadocs page tree Replace the static lib/docs.ts sidebar with a Fumadocs-powered sidebar that reads from the auto-generated page tree (MDX files + meta.json). Keeps the existing visual design — spring animation, scroll indicator, New badges from latest release. The sidebar now auto-discovers pages from content/docs/ without manual nav configuration. * feat(docs): proper MDX pages for all batch 1 components Create example files and full MDX docs for: - color-palette (grid + scale demos) - license-badge (layouts + categories demos) - repo-card (single + grid demos) - contributor-grid (grid + list demo) All 8 batch 1 components now have proper MDX pages with ComponentPreview demos, API reference tables, and notes. 42 pages building successfully. * fix(docs): restore tabbed Preview/Code view in MDX ComponentPreview The MDX ComponentPreview now wraps the real ComponentPreview server component which renders the tabbed Preview + Code panels with syntax-highlighted source files. Previously it was a stripped-down version showing only the live component with no code tab. * feat(docs): restore AI copy + prompt buttons on component pages The catch-all page now detects component pages and renders: - CopyPromptButton with the full AI-friendly component prompt - AiCopyButton with page summary for copying to AI destinations - DependencyBadges showing npm and registry dependencies These match the original ComponentDocsPage header behavior. * fix(docs): correct component names in usage examples, tighten spacing - Fix 13 auto-generated MDX pages that showed ApiRefTable instead of the actual component name in import/usage examples - Reduce MDX content gap from gap-12 to gap-8 for tighter layout * fix(docs): add static pages to sidebar, fix code blocks, correct component names Sidebar: - Add Getting Started section with Components, Installation, Color Themes, Releases as static links above the Fumadocs page tree - All pages now accessible from the sidebar Code blocks: - Replace all markdown triple-backtick blocks with CodeLine components across 27 MDX files so they use the registry's syntax highlighting Component names: - Fix 13 auto-generated pages that showed wrong component names (ApiRefTable instead of the actual component) in usage examples Cleanup: - Rename changelog route to releases - Tighten MDX content spacing (gap-12 → gap-8) * feat(docs): enrich all 28 MDX pages with API Reference and Notes Extract ApiRefTable blocks and Notes sections from old TSX pages (recovered from git history) and append to all stub MDX pages. Every component page now has: - ComponentPreview with tabbed Preview/Code view - InstallBlock with package manager tabs - CodeLine usage examples - API Reference table(s) with all props - Notes section with component-specific details 19 pages enriched automatically + 1 manually (api-ref-table). 8 batch-1 pages were already rich. * fix(docs): fix sidebar layout — remove Introduction, add category separators, tighten spacing - Remove index.mdx from root meta so 'Introduction' doesn't show as a separate sidebar item - Remove components/index from components meta (covered by static link) - Flatten the Components folder into the sidebar so category separators (Code, Docs, Open Source, etc.) render directly - Tighten sidebar gap from gap-6 to gap-1 with pt-5 on separators for clear visual grouping without excess whitespace - Add pb-2 to Getting Started section for separation * feat(docs): restore variant sections for kbd + stepper, update AGENTS.md Kbd: - Add Variants, Sizes, Examples, Color Schemes sections - Import VariantGrid and registry components Stepper: - Add Examples section with status indicators, rich content, horizontal orientation, and custom icons AGENTS.md: - Document Fumadocs MDX docs workflow - Require restoring showcase depth, not just structure - Require Fumadocs page tree for sidebar changes * feat(docs): restore variant sections for file-tree, json-viewer, log-viewer, request-viewer File Tree: - Add Examples section with icon styles, highlighted files, expand state - Import FileTree and define sample tree data JSON Viewer: - Add Examples section with expanded depth and package manifest configs - Import JsonViewer and define sample JSON data Log Viewer: - Add Variants section with Terminal, Filterable, and Minimal variants - Import LogViewer components and define sample logs Request Viewer: - Add Examples section with GET and POST request samples - Import RequestViewer and define network request data * fix(docs): fix MDX syntax in file-tree, restore build * feat(docs): restore variant sections for activity-graph, fix build * feat(docs): restore variant sections for github-buttons, npm-badge, producthunt, tip-jar * feat(docs): restore variant sections for cron-schedule, diff-viewer, ai-copy-button * feat(docs): restore variant sections for code-block, code-block-command * feat(docs): restore variant sections for code-line, producthunt, tip-jar, cron, diff, ai-copy, json, log, request, activity * feat(docs): restore variant sections for api-ref-table, finish parity pass * refactor(docs): revert complex TOC experiment, keep clean build * feat(docs): add inline table of contents to docs pages * feat(docs): widen page layout and move TOC to right sidebar * feat(docs): increase page max-width and content width * feat(docs): maximize content width and refine layout * feat(docs): make content layout edge-to-edge * feat(docs): expand global layout width and remove main content constraints * fix(docs): correct nav link for releases * fix(docs): resolve duplicate catch-all routes and cleanup * fix(docs): resolve route conflicts and clean up duplicate folders * fix(docs): restore optional catch-all for /docs home * fix(docs): fix React 19 script console error * feat(docs): migrate status-indicator to pure MDX * chore(vercel): add configuration for monorepo structure * chore(vercel): remove invalid vercel.json * fix(docs): resolve remaining lint errors * chore(repo): expose previews:generate at root * chore(repo): register previews:generate task in turbo.json * fix(ci): use pnpm check-types for type checking * fix(ci): align root scripts with docs workspace tasks * fix(ci): generate registry index before type checking --------- Co-authored-by: Justin Levine <20596508+justinlevinedotme@users.noreply.github.com>
1 parent b992cf6 commit d57dc21

330 files changed

Lines changed: 8266 additions & 12704 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: pnpm previews:generate
3434

3535
- name: Type check
36-
run: pnpm exec tsc --noEmit
36+
run: pnpm check-types
3737

3838
- name: Registry build
3939
run: pnpm registry:build

.gitignore

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
31
# dependencies
4-
/node_modules
5-
/.pnp
6-
.pnp.*
7-
.yarn/*
8-
!.yarn/patches
9-
!.yarn/plugins
10-
!.yarn/releases
11-
!.yarn/versions
12-
13-
# testing
14-
/coverage
2+
node_modules
153

164
# next.js
17-
/.next/
18-
/out/
5+
.next/
6+
out/
197

208
# production
21-
/build
9+
build
10+
dist
11+
12+
# turbo
13+
.turbo
2214

2315
# misc
2416
.DS_Store
@@ -30,11 +22,11 @@ yarn-debug.log*
3022
yarn-error.log*
3123
.pnpm-debug.log*
3224

33-
# env files (can opt-in for committing if needed)
25+
# env files
3426
.env*
3527

36-
# registry build output (generated by `shadcn build`)
37-
/public/r/
28+
# registry build output
29+
**/public/r/
3830

3931
# vercel
4032
.vercel
@@ -45,10 +37,13 @@ next-env.d.ts
4537

4638
# local agent/tooling artifacts
4739
.agents/
48-
4940
skills-lock.json
5041
bun.lock
51-
.env.local
5242

53-
# Generated preview imports
54-
components/docs/__generated__/
43+
# Generated files
44+
**/components/docs/__generated__/
45+
**/registry/__index__.tsx
46+
**/.source/
47+
48+
# lockfiles (regenerated)
49+
pnpm-lock.yaml

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pnpm exec lint-staged && pnpm exec tsc --noEmit
1+
cd apps/docs && pnpm exec lint-staged

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@ A dev-only page at `/dev/screenshots` renders every component preview at full si
243243
### Writing component docs
244244

245245
- `.pi/references/docs-component-format-spec.md` MUST be followed as the canonical docs format guide for public component and block pages.
246+
- Public docs pages now live in the Fumadocs MDX source under `apps/docs/content/docs/**`. Agents MUST treat MDX as the default docs surface and MUST NOT reintroduce per-component TSX route pages unless explicitly requested.
247+
- For registry-backed component pages, agents MUST preserve the current docs shell behavior: tabbed Preview/Code rendering, AI copy actions, copy prompt actions, dependency badges, and install blocks.
248+
- When migrating or revising component docs, agents MUST restore showcase depth — not just structure. That means meaningful `Variants`, `Sizes`, `Examples`, `Configurations`, or other labeled sections whenever the old page or shipped component warrants them.
249+
- If a pre-migration docs page had multiple demos or variant sections, the migrated MDX page MUST keep equivalent coverage before the work is considered done.
250+
- Examples and demos for MDX pages SHOULD live in reusable files under `apps/docs/registry/<name>/examples/` when that materially improves readability, reuse, or MDX ergonomics.
246251
- Component doc descriptions MUST start with a concise one-sentence summary of what the component does.
247252
- Descriptions MUST NOT start with "A", "An", or "A React component for...".
248253
- Descriptions MUST NOT contain implementation details, subjective adjectives, or unnecessary jargon.
@@ -259,6 +264,7 @@ A dev-only page at `/dev/screenshots` renders every component preview at full si
259264
- When changing a public component's API, variants, states, or installation surface, all affected docs MUST be updated in the same change.
260265
- For public component changes, agents MUST check related docs pages, preview/demo files, homepage or showcase examples, usage snippets, and registry metadata.
261266
- Public variants MUST NOT be added or removed without verifying that labels, examples, and preview coverage still match the shipped component.
267+
- Sidebar/navigation changes in the docs app MUST use the Fumadocs page tree and `meta.json` conventions first. Agents MUST prefer fixing Fumadocs metadata/configuration over replacing the navigation system with custom hardcoded data.
262268

263269
## Releases
264270

0 commit comments

Comments
 (0)