Skip to content

Commit d5936a7

Browse files
Merge pull request #32 from no-witness-labs/feat/migrate-to-fumadocs
feat/migrate to fumadocs
2 parents 37b728b + 39aca5f commit d5936a7

File tree

180 files changed

+2278
-2532
lines changed

Some content is hidden

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

180 files changed

+2278
-2532
lines changed

docs/.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# deps
2+
/node_modules
3+
4+
# generated content
5+
.contentlayer
6+
.content-collections
7+
.source
8+
9+
# test & build
10+
/coverage
11+
/.next/
12+
/out/
13+
/build
14+
*.tsbuildinfo
15+
16+
# misc
17+
.DS_Store
18+
*.pem
19+
/.pnp
20+
.pnp.js
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
# others
26+
.env*.local
27+
.vercel
28+
next-env.d.ts

docs/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# docs
2+
3+
This is a Next.js application generated with
4+
[Create Fumadocs](https://github.com/fuma-nama/fumadocs).
5+
6+
Run development server:
7+
8+
```bash
9+
npm run dev
10+
# or
11+
pnpm dev
12+
# or
13+
yarn dev
14+
```
15+
16+
Open http://localhost:3000 with your browser to see the result.
17+
18+
## Explore
19+
20+
In the project, you can see:
21+
22+
- `lib/source.ts`: Code for content source adapter, [`loader()`](https://fumadocs.dev/docs/headless/source-api) provides the interface to access your content.
23+
- `lib/layout.shared.tsx`: Shared options for layouts, optional but preferred to keep.
24+
25+
| Route | Description |
26+
| ------------------------- | ------------------------------------------------------ |
27+
| `app/(home)` | The route group for your landing page and other pages. |
28+
| `app/docs` | The documentation layout and pages. |
29+
| `app/api/search/route.ts` | The Route Handler for search. |
30+
31+
### Fumadocs MDX
32+
33+
A `source.config.ts` config file has been included, you can customise different options like frontmatter schema.
34+
35+
Read the [Introduction](https://fumadocs.dev/docs/mdx) for further details.
36+
37+
## Learn More
38+
39+
To learn more about Next.js and Fumadocs, take a look at the following
40+
resources:
41+
42+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
43+
features and API.
44+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
45+
- [Fumadocs](https://fumadocs.vercel.app) - learn about Fumadocs

docs/app/(home)/layout.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { HomeLayout } from "fumadocs-ui/layouts/home"
2+
import { baseOptions } from "@/lib/layout.shared"
3+
4+
export default function Layout({ children }: LayoutProps<"/">) {
5+
return <HomeLayout {...baseOptions()}>{children}</HomeLayout>
6+
}

docs/app/(home)/page.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { redirect } from "next/navigation"
2+
3+
export default function HomePage() {
4+
// Permanently redirect root to /docs
5+
redirect("/docs")
6+
}

docs/app/api/search/route.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// import { source } from '@/lib/source';
2+
// import { createFromSource } from 'fumadocs-core/search/server';
3+
4+
// export const { GET } = createFromSource(source, {
5+
// // https://docs.orama.com/docs/orama-js/supported-languages
6+
// language: 'english',
7+
// });
8+
9+
import { source } from "@/lib/source"
10+
import { createFromSource } from "fumadocs-core/search/server"
11+
// it should be cached forever
12+
export const revalidate = false
13+
export const { staticGET: GET } = createFromSource(source)

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

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { source } from "@/lib/source"
2+
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from "fumadocs-ui/page"
3+
import type { Metadata } from "next"
4+
import { notFound } from "next/navigation"
5+
import { createRelativeLink } from "fumadocs-ui/mdx"
6+
import { getMDXComponents } from "@/mdx-components"
7+
8+
export default async function Page(props: PageProps<"/docs/[[...slug]]">) {
9+
const params = await props.params
10+
const page = source.getPage(params.slug)
11+
if (!page) notFound()
12+
13+
const MDXContent = page.data.body
14+
15+
return (
16+
<DocsPage toc={page.data.toc} full={page.data.full}>
17+
<DocsTitle>{page.data.title}</DocsTitle>
18+
<DocsDescription>{page.data.description}</DocsDescription>
19+
<DocsBody>
20+
<MDXContent
21+
components={getMDXComponents({
22+
// this allows you to link to other pages with relative file paths
23+
a: createRelativeLink(source, page)
24+
})}
25+
/>
26+
</DocsBody>
27+
</DocsPage>
28+
)
29+
}
30+
31+
export async function generateStaticParams() {
32+
return source.generateParams()
33+
}
34+
35+
export async function generateMetadata(props: PageProps<"/docs/[[...slug]]">): Promise<Metadata> {
36+
const params = await props.params
37+
const page = source.getPage(params.slug)
38+
if (!page) notFound()
39+
40+
return {
41+
title: page.data.title,
42+
description: page.data.description
43+
}
44+
}

docs/app/docs/layout.tsx

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

docs/app/global.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@import 'tailwindcss';
2+
@import 'fumadocs-ui/css/neutral.css';
3+
@import 'fumadocs-ui/css/preset.css';

docs/app/layout.tsx

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

docs/pages/getting-started/address.mdx renamed to docs/content/docs/getting-started/address/address-format.mdx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
# Address
2-
3-
Address module provides functionality for working with address types in Cardano.
4-
5-
## Address Example
6-
7-
{/* BEGIN:snippet file=address.ts region=address-example lang=typescript */}
1+
---
2+
title: "Address Format"
3+
---
84

95
```typescript
6+
// Examples for Address getting-started page
7+
// Run with: pnpm -w -C docs ts-node examples/address.ts (or a small runner)
8+
109
// #region address-example
1110
import assert from "node:assert/strict"
1211
import { Address } from "@evolution-sdk/evolution"
@@ -22,10 +21,9 @@ const actualBech32 = Address.toBech32(address)
2221

2322
// Verify the conversion is correct
2423
assert.strictEqual(actualBech32, expectedBech32)
25-
```
26-
27-
{/* END:snippet */}
24+
// #endregion address-example
2825

29-
## API Reference
30-
31-
For detailed API documentation, see the generated TypeDoc documentation.
26+
if (import.meta.url === `file://${process.argv[1]}`) {
27+
console.log("Address example OK")
28+
}
29+
```

0 commit comments

Comments
 (0)