Skip to content
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

docs(#434): add the app #452

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ api:
- changed-files:
- any-glob-to-any-file:
- apps/api/*

docs:
- changed-files:
- any-glob-to-any-file:
- docs/*
28 changes: 28 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# deps
/node_modules

# generated content
.contentlayer
.content-collections
.source

# test & build
/coverage
/.next/
/out/
/build
*.tsbuildinfo

# misc
.DS_Store
*.pem
/.pnp
.pnp.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# others
.env*.local
.vercel
next-env.d.ts
26 changes: 26 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# fumadocs-ui-template

This is a Next.js application generated with
[Create Fumadocs](https://github.com/fuma-nama/fumadocs).

Run development server:

```bash
npm run dev
# or
pnpm dev
# or
yarn dev
```

Open http://localhost:3000 with your browser to see the result.

Check notice on line 16 in docs/README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/README.md#L16

Bare URL used

## Learn More

To learn more about Next.js and Fumadocs, take a look at the following
resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
- [Fumadocs](https://fumadocs.vercel.app) - learn about Fumadocs
7 changes: 7 additions & 0 deletions docs/app/(home)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { ReactNode } from 'react';
import { HomeLayout } from 'fumadocs-ui/layouts/home';
import { baseOptions } from '@/app/layout.config';

export default function Layout({ children }: { children: ReactNode }) {
return <HomeLayout {...baseOptions}>{children}</HomeLayout>;
}
38 changes: 38 additions & 0 deletions docs/app/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import Link from 'next/link';

export default function HomePage() {
return (
<main
style={{
flex: 1,
display: 'flex',
flexDirection: 'column',
textAlign: 'center',
justifyContent: 'center',
}}
>
<h1
style={{
fontSize: '2rem',
fontWeight: 'bold',
marginBottom: '1rem',
}}
>
Hello World
</h1>
<p>
You can open{' '}
<Link
href="/docs"
style={{
fontWeight: '600',
textDecoration: 'underline',
}}
>
/docs
</Link>{' '}
and see the documentation.
</p>
</main>
);
}
4 changes: 4 additions & 0 deletions docs/app/api/search/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { source } from '@/lib/source';
import { createFromSource } from 'fumadocs-core/search/server';

export const { GET } = createFromSource(source);

Check failure on line 4 in docs/app/api/search/route.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/api/search/route.ts#L4

Unsafe assignment of an error typed value.

Check failure on line 4 in docs/app/api/search/route.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/api/search/route.ts#L4

Unsafe call of an `error` type typed value.
46 changes: 46 additions & 0 deletions docs/app/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { source } from '@/lib/source';
import {
DocsPage,
DocsBody,
DocsDescription,
DocsTitle,
} from 'fumadocs-ui/page';
import { notFound } from 'next/navigation';
import defaultMdxComponents from 'fumadocs-ui/mdx';

export default async function Page(props: {
params: Promise<{ slug?: string[] }>;
}) {
const params = await props.params;
const page = source.getPage(params.slug);

Check failure on line 15 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L15

Unsafe assignment of an error typed value.

Check failure on line 15 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L15

Unsafe call of an `error` type typed value.

Check failure on line 15 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L15

Unsafe member access .getPage on an `error` typed value.
if (!page) notFound();

const MDX = page.data.body;

Check failure on line 18 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L18

Unsafe assignment of an error typed value.

Check failure on line 18 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L18

Unsafe member access .data on an `error` typed value.

return (
<DocsPage toc={page.data.toc} full={page.data.full}>

Check failure on line 21 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L21

Unsafe assignment of an error typed value.

Check failure on line 21 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L21

Unsafe member access .data on an `error` typed value.
<DocsTitle>{page.data.title}</DocsTitle>

Check failure on line 22 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L22

Unsafe member access .data on an `error` typed value.
<DocsDescription>{page.data.description}</DocsDescription>

Check failure on line 23 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L23

Unsafe member access .data on an `error` typed value.
<DocsBody>
<MDX components={{ ...defaultMdxComponents }} />
</DocsBody>
</DocsPage>
);
}

export async function generateStaticParams() {
return source.generateParams();

Check failure on line 32 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L32

Unsafe call of an `error` type typed value.

Check failure on line 32 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L32

Unsafe member access .generateParams on an `error` typed value.

Check failure on line 32 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L32

Unsafe return of an error typed value.
}

export async function generateMetadata(props: {
params: Promise<{ slug?: string[] }>;
}) {
const params = await props.params;
const page = source.getPage(params.slug);
if (!page) notFound();

return {
title: page.data.title,

Check failure on line 43 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L43

Unsafe assignment of an error typed value.

Check failure on line 43 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L43

Unsafe member access .data on an `error` typed value.
description: page.data.description,

Check failure on line 44 in docs/app/docs/[[...slug]]/page.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/[[...slug]]/page.tsx#L44

Unsafe member access .data on an `error` typed value.
};
}
12 changes: 12 additions & 0 deletions docs/app/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
import type { ReactNode } from 'react';
import { baseOptions } from '@/app/layout.config';
import { source } from '@/lib/source';

export default function Layout({ children }: { children: ReactNode }) {
return (
<DocsLayout tree={source.pageTree} {...baseOptions}>

Check failure on line 8 in docs/app/docs/layout.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/layout.tsx#L8

Unsafe assignment of an error typed value.

Check failure on line 8 in docs/app/docs/layout.tsx

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/app/docs/layout.tsx#L8

Unsafe member access .pageTree on an `error` typed value.
{children}
</DocsLayout>
);
}
22 changes: 22 additions & 0 deletions docs/app/layout.config.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';

/**
* Shared layout configurations
*
* you can configure layouts individually from:
* Home Layout: app/(home)/layout.tsx
* Docs Layout: app/docs/layout.tsx
*/
export const baseOptions: BaseLayoutProps = {
nav: {
// can be JSX too!
title: 'My App',
},
links: [
{
text: 'Documentation',
url: '/docs',
active: 'nested-url',
},
],
};
24 changes: 24 additions & 0 deletions docs/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { RootProvider } from 'fumadocs-ui/provider';
import 'fumadocs-ui/style.css';
import { Inter } from 'next/font/google';
import type { ReactNode } from 'react';

const inter = Inter({
subsets: ['latin'],
});

export default function Layout({ children }: { children: ReactNode }) {
return (
<html lang="en" className={inter.className} suppressHydrationWarning>
<body
style={{
display: 'flex',
flexDirection: 'column',
minHeight: '100vh',
}}
>
<RootProvider>{children}</RootProvider>
</body>
</html>
);
}
13 changes: 13 additions & 0 deletions docs/content/docs/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Hello World
description: Your first document
---

Welcome to the docs! You can start writing documents in `/content/docs`.

## What is Next?

<Cards>
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
<Card title="Learn more about Fumadocs" href="https://fumadocs.vercel.app" />
</Cards>
17 changes: 17 additions & 0 deletions docs/content/docs/test.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: Components
description: Components
---

## Code Block

```js
console.log('Hello World');
```

## Cards

<Cards>
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
<Card title="Learn more about Fumadocs" href="https://fumadocs.vercel.app" />
</Cards>
8 changes: 8 additions & 0 deletions docs/lib/source.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { docs, meta } from '@/.source';
import { createMDXSource } from 'fumadocs-mdx';
import { loader } from 'fumadocs-core/source';

export const source = loader({

Check failure on line 5 in docs/lib/source.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/lib/source.ts#L5

Unsafe assignment of an error typed value.

Check failure on line 5 in docs/lib/source.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/lib/source.ts#L5

Unsafe call of an `error` type typed value.
baseUrl: '/docs',
source: createMDXSource(docs, meta),

Check failure on line 7 in docs/lib/source.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/lib/source.ts#L7

Unsafe assignment of an error typed value.
});
10 changes: 10 additions & 0 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createMDX } from 'fumadocs-mdx/next';

const withMDX = createMDX();

/** @type {import('next').NextConfig} */
const config = {
reactStrictMode: true,
};

export default withMDX(config);
27 changes: 27 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@ashgw/docs",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "next build",
"dev": "next dev",
"start": "next start",
"postinstall": "fumadocs-mdx"
},
"dependencies": {
"docs": "link:",
"fumadocs-core": "14.7.4",
"fumadocs-mdx": "11.3.1",
"fumadocs-ui": "14.7.4",
"next": "catalog:",
"react": "catalog:react18",
"react-dom": "catalog:react18"
},
"devDependencies": {
"@types/mdx": "^2.0.13",
"@types/node": "22.10.6",
"@types/react": "catalog:react18",
"@types/react-dom": "catalog:react18",
"typescript": "catalog:"
}
}
7 changes: 7 additions & 0 deletions docs/source.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineDocs, defineConfig } from 'fumadocs-mdx/config';

export const { docs, meta } = defineDocs({

Check failure on line 3 in docs/source.config.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/source.config.ts#L3

Unsafe call of an `error` type typed value.
dir: 'content/docs',
});

export default defineConfig();

Check failure on line 7 in docs/source.config.ts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/source.config.ts#L7

Unsafe call of an `error` type typed value.
29 changes: 29 additions & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"baseUrl": ".",
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"paths": {
"@/*": ["./*"]
},
"plugins": [
{
"name": "next"
}
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ashgw",
"private": true,
"engines": {
"node": ">=20.18.1",
"node": ">=20",
"pnpm": "^9.12.2"
},
"homepage": "https://ashgw.me",
Expand Down
Loading
Loading