-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate TypeDoc output into new docs site (#140)
- Loading branch information
1 parent
aefafe4
commit 1766db4
Showing
52 changed files
with
448 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import Logo from '@/app/logo'; | ||
import { loaders } from '@/app/source'; | ||
import { Toggle } from '@/app/toggle'; | ||
import { DocsPage, DocsBody } from 'fumadocs-ui/page'; | ||
import { notFound } from 'next/navigation'; | ||
import { DocsLayout } from 'fumadocs-ui/layout'; | ||
import type { Metadata } from 'next'; | ||
|
||
export default async function Page({ | ||
params, | ||
}: { | ||
params: { slug?: string[] }; | ||
}) { | ||
if (!params.slug) { | ||
notFound(); | ||
} | ||
|
||
const root = params.slug[0]; | ||
const loader = loaders.get(root); | ||
if (!loader) { | ||
notFound(); | ||
} | ||
|
||
const page = loader.getPage(params.slug.slice(1)); | ||
|
||
if (page == null) { | ||
notFound(); | ||
} | ||
|
||
const MDX = page.data.exports.default; | ||
|
||
return ( | ||
<DocsLayout | ||
tree={loader.pageTree} | ||
githubUrl={'https://github.com/TooTallNate/nx.js'} | ||
nav={{ | ||
transparentMode: 'top', | ||
title: ( | ||
<> | ||
<Logo className='w-5 md:w-6 drop-shadow' /> nx.js | ||
</> | ||
), | ||
}} | ||
sidebar={{ | ||
banner: <Toggle />, | ||
}} | ||
> | ||
<DocsPage toc={page.data.exports.toc}> | ||
<DocsBody> | ||
<h1>{page.data.title}</h1> | ||
<p className='mb-8 text-lg text-muted-foreground'> | ||
{page.data.description} | ||
</p> | ||
<MDX /> | ||
</DocsBody> | ||
</DocsPage> | ||
</DocsLayout> | ||
); | ||
} | ||
|
||
export async function generateStaticParams() { | ||
return Array.from(loaders.entries()).flatMap(([root, loader]) => | ||
loader.getPages().map((page) => ({ | ||
slug: [root].concat(page.slugs), | ||
})), | ||
); | ||
} | ||
|
||
export function generateMetadata({ params }: { params: { slug?: string[] } }) { | ||
if (!params.slug) { | ||
notFound(); | ||
} | ||
|
||
const root = params.slug[0]; | ||
const loader = loaders.get(root); | ||
if (!loader) { | ||
notFound(); | ||
} | ||
|
||
const page = loader.getPage(params.slug.slice(1)); | ||
|
||
if (page == null) notFound(); | ||
|
||
return { | ||
title: page.data.title, | ||
description: page.data.description, | ||
} satisfies Metadata; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { getPages } from '@/app/source'; | ||
import { loaders } from '@/app/source'; | ||
import { createSearchAPI } from 'fumadocs-core/search/server'; | ||
|
||
export const { GET } = createSearchAPI('advanced', { | ||
indexes: getPages().map((page) => ({ | ||
title: page.data.title, | ||
structuredData: page.data.exports.structuredData, | ||
id: page.url, | ||
url: page.url, | ||
})), | ||
indexes: Array.from(loaders.values()).flatMap((loader) => | ||
loader.getPages().map((page) => ({ | ||
title: page.data.title, | ||
structuredData: page.data.exports.structuredData, | ||
id: page.url, | ||
url: page.url, | ||
})), | ||
), | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
import { join } from 'node:path'; | ||
import { readdirSync } from 'node:fs'; | ||
import { fileURLToPath } from 'node:url'; | ||
import { map } from '@/.map'; | ||
import { createMDXSource } from 'fumadocs-mdx'; | ||
import { loader } from 'fumadocs-core/source'; | ||
|
||
export const { getPage, getPages, pageTree } = loader({ | ||
baseUrl: '/docs', | ||
rootDir: 'docs', | ||
source: createMDXSource(map), | ||
}); | ||
const contentDir = join(fileURLToPath(import.meta.url), '../../content'); | ||
|
||
export const loaders: Map< | ||
string, | ||
ReturnType<typeof loader<{ source: ReturnType<typeof createMDXSource> }>> | ||
> = new Map( | ||
readdirSync(contentDir).map((name) => [ | ||
name, | ||
loader({ | ||
baseUrl: `/${name}`, | ||
rootDir: name, | ||
source: createMDXSource(map), | ||
}), | ||
]), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { TbGlobe, TbBrowser, TbBrandPowershell } from 'react-icons/tb'; | ||
import { RootToggle } from 'fumadocs-ui/components/layout/root-toggle'; | ||
|
||
export function Toggle() { | ||
return ( | ||
<RootToggle | ||
options={[ | ||
{ | ||
title: 'Runtime', | ||
description: 'Global APIs', | ||
url: '/runtime', | ||
icon: <TbGlobe size={24} />, | ||
}, | ||
{ | ||
title: '@nx.js/http', | ||
description: 'HTTP server for nx.js', | ||
url: '/http', | ||
icon: <TbBrowser size={24} />, | ||
}, | ||
{ | ||
title: '@nx.js/repl', | ||
description: 'Read-Eval-Print Loop for nx.js', | ||
url: '/repl', | ||
icon: <TbBrandPowershell size={24} />, | ||
}, | ||
]} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: Installation | ||
--- | ||
|
||
<InstallTabs items={['npm', 'pnpm', 'yarn', 'bun']}> | ||
<Tab value='npm'> | ||
|
||
```bash | ||
npm install @nx.js/http | ||
``` | ||
|
||
</Tab> | ||
<Tab value="pnpm"> | ||
|
||
```bash | ||
pnpm add @nx.js/http | ||
``` | ||
|
||
</Tab> | ||
<Tab value='yarn'> | ||
|
||
```bash | ||
yarn add @nx.js/http | ||
``` | ||
|
||
</Tab> | ||
<Tab value='bun'> | ||
|
||
```bash | ||
bun add @nx.js/http | ||
``` | ||
|
||
</Tab> | ||
|
||
</InstallTabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"root": true, | ||
"pages": ["--- Usage ---", "index", "--- API Reference ---", "...api"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: Installation | ||
--- | ||
|
||
<InstallTabs items={['npm', 'pnpm', 'yarn', 'bun']}> | ||
<Tab value='npm'> | ||
|
||
```bash | ||
npm install @nx.js/repl | ||
``` | ||
|
||
</Tab> | ||
<Tab value="pnpm"> | ||
|
||
```bash | ||
pnpm add @nx.js/repl | ||
``` | ||
|
||
</Tab> | ||
<Tab value='yarn'> | ||
|
||
```bash | ||
yarn add @nx.js/repl | ||
``` | ||
|
||
</Tab> | ||
<Tab value='bun'> | ||
|
||
```bash | ||
bun add @nx.js/repl | ||
``` | ||
|
||
</Tab> | ||
|
||
</InstallTabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"root": true, | ||
"pages": ["--- Usage ---", "index", "--- API Reference ---", "...api"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.