Skip to content

Commit 8c22259

Browse files
Copilothotlong
andcommitted
feat: initialize fumadocs site structure in apps/site
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 2481bfe commit 8c22259

104 files changed

Lines changed: 30447 additions & 0 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.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ dist
1010
docs/.vitepress/cache
1111
docs/.vitepress/dist
1212

13+
# Fumadocs / Next.js
14+
apps/site/.next
15+
apps/site/out
16+
apps/site/.source
17+
1318
# Database
1419
*.sqlite3
1520
*.db

apps/site/.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

apps/site/.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# dependencies
2+
/node_modules
3+
/.pnp
4+
.pnp.js
5+
6+
# testing
7+
/coverage
8+
9+
# next.js
10+
/.next/
11+
/out/
12+
13+
# production
14+
/build
15+
16+
# misc
17+
.DS_Store
18+
*.pem
19+
20+
# debug
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
# local env files
26+
.env*.local
27+
28+
# vercel
29+
.vercel
30+
31+
# typescript
32+
*.tsbuildinfo
33+
next-env.d.ts
34+
35+
# fumadocs
36+
.source
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { source } from '@/lib/source';
2+
import type { Metadata } from 'next';
3+
import { DocsPage, DocsBody, DocsDescription, DocsTitle } from 'fumadocs-ui/page';
4+
import { notFound } from 'next/navigation';
5+
import defaultMdxComponents from 'fumadocs-ui/mdx';
6+
7+
export default async function Page({
8+
params,
9+
}: {
10+
params: { slug?: string[] };
11+
}) {
12+
const page = source.getPage(params.slug);
13+
if (!page) notFound();
14+
15+
const MDX = page.data.body;
16+
17+
return (
18+
<DocsPage toc={page.data.toc} full={page.data.full}>
19+
<DocsTitle>{page.data.title}</DocsTitle>
20+
<DocsDescription>{page.data.description}</DocsDescription>
21+
<DocsBody>
22+
<MDX components={{ ...defaultMdxComponents }} />
23+
</DocsBody>
24+
</DocsPage>
25+
);
26+
}
27+
28+
export async function generateStaticParams() {
29+
return source.generateParams();
30+
}
31+
32+
export function generateMetadata({ params }: { params: { slug?: string[] } }): Metadata {
33+
const page = source.getPage(params.slug);
34+
if (!page) notFound();
35+
36+
return {
37+
title: page.data.title,
38+
description: page.data.description,
39+
};
40+
}

apps/site/app/docs/layout.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { source } from '@/lib/source';
2+
import type { ReactNode } from 'react';
3+
import { DocsLayout } from 'fumadocs-ui/layout';
4+
import { baseOptions } from '@/app/layout.config';
5+
6+
export default function Layout({ children }: { children: ReactNode }) {
7+
return (
8+
<DocsLayout tree={source.pageTree} {...baseOptions}>
9+
{children}
10+
</DocsLayout>
11+
);
12+
}

apps/site/app/globals.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;

apps/site/app/layout.config.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { BaseLayoutProps } from 'fumadocs-ui/layout';
2+
import { Book, Code2, FileText, Sparkles } from 'lucide-react';
3+
4+
export const baseOptions: BaseLayoutProps = {
5+
nav: {
6+
title: 'ObjectQL',
7+
},
8+
links: [
9+
{
10+
text: 'Documentation',
11+
url: '/docs',
12+
active: 'nested-url',
13+
},
14+
],
15+
githubUrl: 'https://github.com/objectstack-ai/objectql',
16+
};

apps/site/app/layout.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import './globals.css';
2+
import type { ReactNode } from 'react';
3+
import { RootProvider } from 'fumadocs-ui/provider';
4+
import { Inter } from 'next/font/google';
5+
6+
const inter = Inter({
7+
subsets: ['latin'],
8+
});
9+
10+
export default function Layout({ children }: { children: ReactNode }) {
11+
return (
12+
<html lang="en" className={inter.className} suppressHydrationWarning>
13+
<body>
14+
<RootProvider>{children}</RootProvider>
15+
</body>
16+
</html>
17+
);
18+
}

apps/site/app/page.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default function HomePage() {
2+
return (
3+
<main className="flex h-screen flex-col items-center justify-center">
4+
<h1 className="mb-4 text-4xl font-bold">ObjectQL Documentation</h1>
5+
<p className="text-lg text-muted-foreground">
6+
Visit <a href="/docs" className="text-blue-600 hover:underline">/docs</a> to view the documentation
7+
</p>
8+
</main>
9+
);
10+
}

0 commit comments

Comments
 (0)