-
Notifications
You must be signed in to change notification settings - Fork 40
Feat: Migrate to Fumadocs and Update Contribution Guidelines (Issue #8) #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…e.json and pnpm-lock.yaml
…ing @types/mdx and fumadocs-mdx
…ate package.json and pnpm-lock.yaml with new dependencies
…on and configuration files accordingly
…ue creation best practices, and UI development recommendations
…build validation with Fumadocs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the documentation site from Contentlayer to Fumadocs as the content management framework, modernizing the UI components and updating the contribution guidelines. The migration addresses Contentlayer's discontinued maintenance status and provides a more modern documentation experience.
- Replaced Contentlayer with Fumadocs for content management and MDX processing
- Integrated Fumadocs UI components for modern documentation interface with built-in features like TOC and theme switching
- Updated contribution guidelines to require Issue submission before development and emphasize Fumadocs UI component usage
Reviewed Changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| source.config.ts | New Fumadocs configuration defining docs collection from app/docs directory |
| package.json | Updated dependencies - removed Contentlayer packages, added Fumadocs packages, changed postinstall script |
| next.config.mjs | Replaced withContentlayer with createMDX from fumadocs-mdx/next |
| lib/source.ts | New source loader configuration for Fumadocs |
| app/docs/[...slug]/page.tsx | Refactored to use Fumadocs source.getPage() and DocsPage/DocsBody components |
| app/layout.tsx | Added RootProvider wrapper and updated metadata |
| app/globals.css | Added Fumadocs UI CSS imports for styling |
| CONTRIBUTING.md | Added development workflow guidelines requiring Issues before development and UI development recommendations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
app/docs/[...slug]/page.tsx
Outdated
| export async function generateMetadata({ params }: Param): Promise<Metadata> { | ||
| const { slug } = await params; | ||
| const page = source.getPage(slug); | ||
| if (page == null) notFound(); |
Copilot
AI
Sep 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The notFound() call should include a return statement to satisfy TypeScript's control flow analysis and make the code intention clearer.
| if (page == null) notFound(); | |
| if (page == null) { | |
| notFound(); | |
| return; | |
| } |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
关联 Issue: Issue #8
What
此 PR 完成了以下主要工作:
Contentlayer完全迁移到Fumadocs。CONTRIBUTING.md文件中增加了关于功能开发前提交 Issue 的说明,并提供了 UI 开发建议,强调优先使用 Fumadocs UI 组件库。Why
进行这些更改的原因如下:
How
这些更改的实现方式和测试验证包括:
contentlayer和next-contentlayer依赖。fumadocs-core,fumadocs-ui,fumadocs-mdx。source.config.ts定义文档集合。next.config.mjs,使用createMDX替换withContentlayer。lib/source.ts加载 Fumadocs 内容源。package.json中的postinstall脚本以生成 Fumadocs 类型。tsconfig.json以识别新的.source目录别名。mdx-components.tsx用于管理 MDX 渲染组件。app/layout.tsx,用RootProvider包裹应用以提供全局 UI 上下文。app/globals.css中引入了 Fumadocs UI 的基础样式。lib/layout.shared.tsx来定义全局导航配置(如网站标题)。app/docs/layout.tsx,使用DocsLayout提供文档页面的整体布局(包含侧边栏)。app/docs/[...slug]/page.tsx,使其通过source.getPage()获取内容,并使用DocsPage和DocsBody组件渲染,同时支持generateStaticParams和generateMetadata。CONTRIBUTING.md文件中,新增了"📋 开发流程"和"💡 UI 开发建议"章节,详细说明了相关规范和建议。Testing
在提交此 PR 之前,已进行了以下测试:
pnpm dev,确认应用成功启动,所有文档页面正常渲染,导航、目录、主题切换等 Fumadocs UI 功能按预期工作。pnpm build,确保 Fumadocs 内容生成和 Next.js 静态导出过程无错误。CONTRIBUTING.md文件,确保新增的说明内容正确、格式清晰,且中英文版本均已更新。Breaking Changes
是的,此 PR 引入了以下破坏性更改:
import { allDocs } from 'contentlayer/generated')都需要更新为 Fumadocs 的source.getPage()或source.getPages()方法。MDXContent组件已不再使用,渲染逻辑已迁移至 Fumadocs UI 提供的DocsPage和DocsBody。contentlayer.config.ts已被 Fumadocs 的source.config.ts取代。