Skip to content

Commit c8c9a1f

Browse files
authored
Merge pull request #138 from objectstack-ai/copilot/update-documentation-to-fumadocs
2 parents 72d0dbb + 4a839ac commit c8c9a1f

File tree

106 files changed

+34761
-122
lines changed

Some content is hidden

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

106 files changed

+34761
-122
lines changed

.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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { DocsLayoutProps } from 'fumadocs-ui/layout';
2+
// @ts-ignore: optional dev dependency for icons (some environments may not have types)
3+
import { Book, Code2, FileText, Sparkles } from 'lucide-react';
4+
5+
export const baseOptions: Omit<DocsLayoutProps, 'tree'> = {
6+
nav: {
7+
title: 'ObjectQL',
8+
},
9+
links: [
10+
{
11+
text: 'Documentation',
12+
url: '/docs',
13+
active: 'nested-url',
14+
},
15+
],
16+
githubUrl: 'https://github.com/objectstack-ai/objectql',
17+
};

apps/site/app/layout.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import './globals.css';
2+
import type { ReactNode } from 'react';
3+
import { RootProvider } from 'fumadocs-ui/provider';
4+
5+
export default function Layout({ children }: { children: ReactNode }) {
6+
return (
7+
<html lang="en" suppressHydrationWarning>
8+
<body>
9+
<RootProvider>{children}</RootProvider>
10+
</body>
11+
</html>
12+
);
13+
}

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)