@hanzo/docs-create-app 16.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/auto-install-CenyMuK7.js +33 -0
- package/dist/auto-install-CenyMuK7.js.map +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +165 -0
- package/dist/bin.js.map +1 -0
- package/dist/constants-BkYWkLHa.d.ts +22 -0
- package/dist/constants-BkYWkLHa.d.ts.map +1 -0
- package/dist/constants-CbNzssp2.js +957 -0
- package/dist/constants-CbNzssp2.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/biome.base.d.ts +40 -0
- package/dist/plugins/biome.base.d.ts.map +1 -0
- package/dist/plugins/biome.base.js +38 -0
- package/dist/plugins/biome.base.js.map +1 -0
- package/dist/plugins/biome.d.ts +7 -0
- package/dist/plugins/biome.d.ts.map +1 -0
- package/dist/plugins/biome.js +33 -0
- package/dist/plugins/biome.js.map +1 -0
- package/dist/plugins/biome.next.d.ts +41 -0
- package/dist/plugins/biome.next.d.ts.map +1 -0
- package/dist/plugins/biome.next.js +44 -0
- package/dist/plugins/biome.next.js.map +1 -0
- package/dist/plugins/eslint.d.ts +7 -0
- package/dist/plugins/eslint.d.ts.map +1 -0
- package/dist/plugins/eslint.js +47 -0
- package/dist/plugins/eslint.js.map +1 -0
- package/dist/plugins/next-use-src.d.ts +10 -0
- package/dist/plugins/next-use-src.d.ts.map +1 -0
- package/dist/plugins/next-use-src.js +37 -0
- package/dist/plugins/next-use-src.js.map +1 -0
- package/dist/plugins/orama-cloud.d.ts +7 -0
- package/dist/plugins/orama-cloud.d.ts.map +1 -0
- package/dist/plugins/orama-cloud.js +296 -0
- package/dist/plugins/orama-cloud.js.map +1 -0
- package/package.json +63 -0
- package/template/+next+fuma-docs-mdx/app/(home)/layout.tsx +6 -0
- package/template/+next+fuma-docs-mdx/app/(home)/page.tsx +16 -0
- package/template/+next+fuma-docs-mdx/app/api/search/route.ts +7 -0
- package/template/+next+fuma-docs-mdx/app/docs/[[...slug]]/page.tsx +57 -0
- package/template/+next+fuma-docs-mdx/app/docs/layout.tsx +11 -0
- package/template/+next+fuma-docs-mdx/app/global.css +3 -0
- package/template/+next+fuma-docs-mdx/app/layout.tsx +17 -0
- package/template/+next+fuma-docs-mdx/app/llms-full.txt/route.ts +10 -0
- package/template/+next+fuma-docs-mdx/app/llms.mdx/docs/[[...slug]]/route.ts +20 -0
- package/template/+next+fuma-docs-mdx/app/llms.txt/route.ts +13 -0
- package/template/+next+fuma-docs-mdx/app/og/docs/[...slug]/route.tsx +27 -0
- package/template/+next+fuma-docs-mdx/components/ai/page-actions.tsx +240 -0
- package/template/+next+fuma-docs-mdx/content/docs/index.mdx +13 -0
- package/template/+next+fuma-docs-mdx/content/docs/test.mdx +17 -0
- package/template/+next+fuma-docs-mdx/example.gitignore +26 -0
- package/template/+next+fuma-docs-mdx/lib/cn.ts +1 -0
- package/template/+next+fuma-docs-mdx/lib/layout.shared.tsx +17 -0
- package/template/+next+fuma-docs-mdx/lib/source.ts +27 -0
- package/template/+next+fuma-docs-mdx/mdx-components.tsx +9 -0
- package/template/+next+fuma-docs-mdx/next.config.mjs +18 -0
- package/template/+next+fuma-docs-mdx/package.json +31 -0
- package/template/+next+fuma-docs-mdx/postcss.config.mjs +7 -0
- package/template/+next+fuma-docs-mdx/source.config.ts +23 -0
- package/template/+next+fuma-docs-mdx/tsconfig.json +36 -0
- package/template/+next+fuma-docs-mdx+static/README.md +45 -0
- package/template/+next+fuma-docs-mdx+static/app/(home)/layout.tsx +6 -0
- package/template/+next+fuma-docs-mdx+static/app/(home)/page.tsx +16 -0
- package/template/+next+fuma-docs-mdx+static/app/api/search/route.ts +9 -0
- package/template/+next+fuma-docs-mdx+static/app/docs/[[...slug]]/page.tsx +47 -0
- package/template/+next+fuma-docs-mdx+static/app/docs/layout.tsx +11 -0
- package/template/+next+fuma-docs-mdx+static/app/global.css +3 -0
- package/template/+next+fuma-docs-mdx+static/app/layout.tsx +17 -0
- package/template/+next+fuma-docs-mdx+static/app/llms-full.txt/route.ts +10 -0
- package/template/+next+fuma-docs-mdx+static/app/og/docs/[...slug]/route.tsx +27 -0
- package/template/+next+fuma-docs-mdx+static/components/provider.tsx +8 -0
- package/template/+next+fuma-docs-mdx+static/components/search.tsx +46 -0
- package/template/+next+fuma-docs-mdx+static/content/docs/index.mdx +13 -0
- package/template/+next+fuma-docs-mdx+static/content/docs/test.mdx +17 -0
- package/template/+next+fuma-docs-mdx+static/example.gitignore +26 -0
- package/template/+next+fuma-docs-mdx+static/lib/layout.shared.tsx +9 -0
- package/template/+next+fuma-docs-mdx+static/lib/source.ts +26 -0
- package/template/+next+fuma-docs-mdx+static/mdx-components.tsx +9 -0
- package/template/+next+fuma-docs-mdx+static/next.config.mjs +11 -0
- package/template/+next+fuma-docs-mdx+static/package.json +32 -0
- package/template/+next+fuma-docs-mdx+static/postcss.config.mjs +7 -0
- package/template/+next+fuma-docs-mdx+static/source.config.ts +23 -0
- package/template/+next+fuma-docs-mdx+static/tsconfig.json +36 -0
- package/template/+next+hanzo-docs-mdx/README.md +43 -0
- package/template/+next+hanzo-docs-mdx/app/(home)/layout.tsx +6 -0
- package/template/+next+hanzo-docs-mdx/app/(home)/page.tsx +16 -0
- package/template/+next+hanzo-docs-mdx/app/api/search/route.ts +7 -0
- package/template/+next+hanzo-docs-mdx/app/docs/[[...slug]]/page.tsx +61 -0
- package/template/+next+hanzo-docs-mdx/app/docs/layout.tsx +11 -0
- package/template/+next+hanzo-docs-mdx/app/global.css +3 -0
- package/template/+next+hanzo-docs-mdx/app/layout.tsx +17 -0
- package/template/+next+hanzo-docs-mdx/app/llms-full.txt/route.ts +10 -0
- package/template/+next+hanzo-docs-mdx/app/og/docs/[...slug]/route.tsx +27 -0
- package/template/+next+hanzo-docs-mdx/content/docs/index.mdx +13 -0
- package/template/+next+hanzo-docs-mdx/content/docs/test.mdx +17 -0
- package/template/+next+hanzo-docs-mdx/example.gitignore +26 -0
- package/template/+next+hanzo-docs-mdx/lib/cn.ts +1 -0
- package/template/+next+hanzo-docs-mdx/lib/layout.shared.tsx +9 -0
- package/template/+next+hanzo-docs-mdx/lib/source.ts +27 -0
- package/template/+next+hanzo-docs-mdx/mdx-components.tsx +9 -0
- package/template/+next+hanzo-docs-mdx/next.config.mjs +18 -0
- package/template/+next+hanzo-docs-mdx/package.json +31 -0
- package/template/+next+hanzo-docs-mdx/postcss.config.mjs +5 -0
- package/template/+next+hanzo-docs-mdx/source.config.ts +23 -0
- package/template/+next+hanzo-docs-mdx/tsconfig.json +36 -0
- package/template/+orama-cloud/@app/components/search.tsx +54 -0
- package/template/+orama-cloud/@app/lib/export-static-indexes.ts +14 -0
- package/template/+orama-cloud/@root/.env.example +6 -0
- package/template/react-router/README.md +12 -0
- package/template/react-router/app/app.css +3 -0
- package/template/react-router/app/docs/page.tsx +51 -0
- package/template/react-router/app/docs/search.ts +12 -0
- package/template/react-router/app/lib/layout.shared.tsx +9 -0
- package/template/react-router/app/lib/source.ts +7 -0
- package/template/react-router/app/root.tsx +73 -0
- package/template/react-router/app/routes/home.tsx +30 -0
- package/template/react-router/app/routes.ts +7 -0
- package/template/react-router/content/docs/index.mdx +32 -0
- package/template/react-router/content/docs/meta.json +3 -0
- package/template/react-router/content/docs/test.mdx +24 -0
- package/template/react-router/example.gitignore +7 -0
- package/template/react-router/package.json +35 -0
- package/template/react-router/public/favicon.ico +0 -0
- package/template/react-router/react-router.config.ts +23 -0
- package/template/react-router/source.config.ts +7 -0
- package/template/react-router/tsconfig.json +23 -0
- package/template/react-router/vite.config.ts +17 -0
- package/template/react-router-spa/README.md +12 -0
- package/template/react-router-spa/app/app.css +3 -0
- package/template/react-router-spa/app/components/search.tsx +45 -0
- package/template/react-router-spa/app/docs/page.tsx +53 -0
- package/template/react-router-spa/app/docs/search.ts +10 -0
- package/template/react-router-spa/app/lib/layout.shared.tsx +9 -0
- package/template/react-router-spa/app/lib/source.ts +7 -0
- package/template/react-router-spa/app/root.tsx +74 -0
- package/template/react-router-spa/app/routes/home.tsx +30 -0
- package/template/react-router-spa/app/routes.ts +7 -0
- package/template/react-router-spa/content/docs/index.mdx +32 -0
- package/template/react-router-spa/content/docs/test.mdx +24 -0
- package/template/react-router-spa/example.gitignore +7 -0
- package/template/react-router-spa/package.json +36 -0
- package/template/react-router-spa/public/favicon.ico +0 -0
- package/template/react-router-spa/react-router.config.ts +23 -0
- package/template/react-router-spa/serve.json +3 -0
- package/template/react-router-spa/source.config.ts +7 -0
- package/template/react-router-spa/tsconfig.json +23 -0
- package/template/react-router-spa/vite.config.ts +17 -0
- package/template/tanstack-start/README.md +12 -0
- package/template/tanstack-start/content/docs/index.mdx +31 -0
- package/template/tanstack-start/content/docs/test.mdx +12 -0
- package/template/tanstack-start/example.gitignore +18 -0
- package/template/tanstack-start/package.json +38 -0
- package/template/tanstack-start/source.config.ts +7 -0
- package/template/tanstack-start/src/components/not-found.tsx +28 -0
- package/template/tanstack-start/src/lib/layout.shared.tsx +9 -0
- package/template/tanstack-start/src/lib/source.ts +9 -0
- package/template/tanstack-start/src/router.tsx +12 -0
- package/template/tanstack-start/src/routes/__root.tsx +45 -0
- package/template/tanstack-start/src/routes/api/search.ts +16 -0
- package/template/tanstack-start/src/routes/docs/$.tsx +72 -0
- package/template/tanstack-start/src/routes/index.tsx +26 -0
- package/template/tanstack-start/src/styles/app.css +3 -0
- package/template/tanstack-start/tsconfig.json +24 -0
- package/template/tanstack-start/vite.config.ts +33 -0
- package/template/tanstack-start-spa/README.md +12 -0
- package/template/tanstack-start-spa/content/docs/index.mdx +31 -0
- package/template/tanstack-start-spa/content/docs/test.mdx +12 -0
- package/template/tanstack-start-spa/example.gitignore +18 -0
- package/template/tanstack-start-spa/package.json +41 -0
- package/template/tanstack-start-spa/source.config.ts +7 -0
- package/template/tanstack-start-spa/src/components/not-found.tsx +28 -0
- package/template/tanstack-start-spa/src/components/search.tsx +46 -0
- package/template/tanstack-start-spa/src/lib/layout.shared.tsx +9 -0
- package/template/tanstack-start-spa/src/lib/source.ts +9 -0
- package/template/tanstack-start-spa/src/router.tsx +12 -0
- package/template/tanstack-start-spa/src/routes/__root.tsx +46 -0
- package/template/tanstack-start-spa/src/routes/api/search.ts +16 -0
- package/template/tanstack-start-spa/src/routes/docs/$.tsx +74 -0
- package/template/tanstack-start-spa/src/routes/index.tsx +26 -0
- package/template/tanstack-start-spa/src/styles/app.css +3 -0
- package/template/tanstack-start-spa/tsconfig.json +24 -0
- package/template/tanstack-start-spa/vite.config.ts +42 -0
- package/template/waku/README.md +11 -0
- package/template/waku/content/docs/index.mdx +31 -0
- package/template/waku/content/docs/test.mdx +12 -0
- package/template/waku/example.gitignore +6 -0
- package/template/waku/package.json +33 -0
- package/template/waku/source.config.ts +7 -0
- package/template/waku/src/components/provider.tsx +7 -0
- package/template/waku/src/lib/layout.shared.tsx +9 -0
- package/template/waku/src/lib/source.ts +9 -0
- package/template/waku/src/pages/(home)/_layout.tsx +7 -0
- package/template/waku/src/pages/(home)/index.tsx +21 -0
- package/template/waku/src/pages/_api/api/search.ts +4 -0
- package/template/waku/src/pages/_root.tsx +20 -0
- package/template/waku/src/pages/docs/[...slugs].tsx +45 -0
- package/template/waku/src/pages/docs/_layout.tsx +12 -0
- package/template/waku/src/styles/globals.css +9 -0
- package/template/waku/tsconfig.json +25 -0
- package/template/waku/waku.config.ts +17 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getPageImage, source } from '@/lib/source';
|
|
2
|
+
import { notFound } from 'next/navigation';
|
|
3
|
+
import { ImageResponse } from 'next/og';
|
|
4
|
+
import { generate as DefaultImage } from '@hanzo/docs/ui/og';
|
|
5
|
+
|
|
6
|
+
export const revalidate = false;
|
|
7
|
+
|
|
8
|
+
export async function GET(_req: Request, { params }: RouteContext<'/og/docs/[...slug]'>) {
|
|
9
|
+
const { slug } = await params;
|
|
10
|
+
const page = source.getPage(slug.slice(0, -1));
|
|
11
|
+
if (!page) notFound();
|
|
12
|
+
|
|
13
|
+
return new ImageResponse(
|
|
14
|
+
<DefaultImage title={page.data.title} description={page.data.description} site="My App" />,
|
|
15
|
+
{
|
|
16
|
+
width: 1200,
|
|
17
|
+
height: 630,
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function generateStaticParams() {
|
|
23
|
+
return source.getPages().map((page) => ({
|
|
24
|
+
lang: page.locale,
|
|
25
|
+
slug: getPageImage(page).segments,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import SearchDialog from '@/components/search';
|
|
3
|
+
import { RootProvider } from '@hanzo/docs-base-ui/provider/next';
|
|
4
|
+
import { type ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
export function Provider({ children }: { children: ReactNode }) {
|
|
7
|
+
return <RootProvider search={{ SearchDialog }}>{children}</RootProvider>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
SearchDialog,
|
|
4
|
+
SearchDialogClose,
|
|
5
|
+
SearchDialogContent,
|
|
6
|
+
SearchDialogHeader,
|
|
7
|
+
SearchDialogIcon,
|
|
8
|
+
SearchDialogInput,
|
|
9
|
+
SearchDialogList,
|
|
10
|
+
SearchDialogOverlay,
|
|
11
|
+
type SharedProps,
|
|
12
|
+
} from '@hanzo/docs-base-ui/components/dialog/search';
|
|
13
|
+
import { useDocsSearch } from '@hanzo/docs-core/search/client';
|
|
14
|
+
import { create } from '@orama/orama';
|
|
15
|
+
import { useI18n } from '@hanzo/docs-base-ui/contexts/i18n';
|
|
16
|
+
|
|
17
|
+
function initOrama() {
|
|
18
|
+
return create({
|
|
19
|
+
schema: { _: 'string' },
|
|
20
|
+
// https://docs.orama.com/docs/orama-js/supported-languages
|
|
21
|
+
language: 'english',
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function DefaultSearchDialog(props: SharedProps) {
|
|
26
|
+
const { locale } = useI18n(); // (optional) for i18n
|
|
27
|
+
const { search, setSearch, query } = useDocsSearch({
|
|
28
|
+
type: 'static',
|
|
29
|
+
initOrama,
|
|
30
|
+
locale,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<SearchDialog search={search} onSearchChange={setSearch} isLoading={query.isLoading} {...props}>
|
|
35
|
+
<SearchDialogOverlay />
|
|
36
|
+
<SearchDialogContent>
|
|
37
|
+
<SearchDialogHeader>
|
|
38
|
+
<SearchDialogIcon />
|
|
39
|
+
<SearchDialogInput />
|
|
40
|
+
<SearchDialogClose />
|
|
41
|
+
</SearchDialogHeader>
|
|
42
|
+
<SearchDialogList items={query.data !== 'empty' ? query.data : null} />
|
|
43
|
+
</SearchDialogContent>
|
|
44
|
+
</SearchDialog>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Hello World
|
|
3
|
+
description: Your first document
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Welcome to the docs! You can start writing documents in `/content/docs`.
|
|
7
|
+
|
|
8
|
+
## What is Next?
|
|
9
|
+
|
|
10
|
+
<Cards>
|
|
11
|
+
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
|
|
12
|
+
<Card title="Learn more about Hanzo Docs" href="https://hanzo-docs.dev" />
|
|
13
|
+
</Cards>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Components
|
|
3
|
+
description: Components
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Code Block
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
console.log('Hello World');
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Cards
|
|
13
|
+
|
|
14
|
+
<Cards>
|
|
15
|
+
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
|
|
16
|
+
<Card title="Learn more about Hanzo Docs" href="https://hanzo-docs.dev" />
|
|
17
|
+
</Cards>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# deps
|
|
2
|
+
/node_modules
|
|
3
|
+
|
|
4
|
+
# generated content
|
|
5
|
+
docs
|
|
6
|
+
|
|
7
|
+
# test & build
|
|
8
|
+
/coverage
|
|
9
|
+
/.next/
|
|
10
|
+
/out/
|
|
11
|
+
/build
|
|
12
|
+
*.tsbuildinfo
|
|
13
|
+
|
|
14
|
+
# misc
|
|
15
|
+
.DS_Store
|
|
16
|
+
*.pem
|
|
17
|
+
/.pnp
|
|
18
|
+
.pnp.js
|
|
19
|
+
npm-debug.log*
|
|
20
|
+
yarn-debug.log*
|
|
21
|
+
yarn-error.log*
|
|
22
|
+
|
|
23
|
+
# others
|
|
24
|
+
.env*.local
|
|
25
|
+
.vercel
|
|
26
|
+
next-env.d.ts
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { docs } from '@hanzo/docs-mdx:collections/server';
|
|
2
|
+
import { type InferPageType, loader } from '@hanzo/docs-core/source';
|
|
3
|
+
|
|
4
|
+
// See https://docs.hanzo.ai/docs/headless/source-api for more info
|
|
5
|
+
export const source = loader({
|
|
6
|
+
baseUrl: '/docs',
|
|
7
|
+
source: docs.toHanzoDocsSource(),
|
|
8
|
+
plugins: [],
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export function getPageImage(page: InferPageType<typeof source>) {
|
|
12
|
+
const segments = [...page.slugs, 'image.png'];
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
segments,
|
|
16
|
+
url: `/og/docs/${segments.join('/')}`,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function getLLMText(page: InferPageType<typeof source>) {
|
|
21
|
+
const processed = await page.data.getText('processed');
|
|
22
|
+
|
|
23
|
+
return `# ${page.data.title}
|
|
24
|
+
|
|
25
|
+
${processed}`;
|
|
26
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "example-next-static",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "next build",
|
|
7
|
+
"dev": "next dev",
|
|
8
|
+
"start": "serve out",
|
|
9
|
+
"types:check": "@hanzo/docs-mdx && next typegen && tsc --noEmit"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@orama/orama": "^3.1.18",
|
|
13
|
+
"@hanzo/docs-core": "workspace:*",
|
|
14
|
+
"@hanzo/docs-mdx": "workspace:*",
|
|
15
|
+
"@hanzo/docs-base-ui": "workspace:*",
|
|
16
|
+
"lucide-react": "^0.563.0",
|
|
17
|
+
"next": "16.1.6",
|
|
18
|
+
"react": "^19.2.4",
|
|
19
|
+
"react-dom": "^19.2.4"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@tailwindcss/postcss": "^4.1.18",
|
|
23
|
+
"@types/mdx": "^2.0.13",
|
|
24
|
+
"@types/node": "^25.2.1",
|
|
25
|
+
"@types/react": "^19.2.13",
|
|
26
|
+
"@types/react-dom": "^19.2.3",
|
|
27
|
+
"postcss": "^8.5.6",
|
|
28
|
+
"serve": "^14.2.5",
|
|
29
|
+
"tailwindcss": "^4.1.18",
|
|
30
|
+
"typescript": "^5.9.3"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineConfig, defineDocs } from '@hanzo/docs-mdx/config';
|
|
2
|
+
import { metaSchema, pageSchema } from '@hanzo/docs-core/source/schema';
|
|
3
|
+
|
|
4
|
+
// You can customise Zod schemas for frontmatter and `meta.json` here
|
|
5
|
+
// see https://docs.hanzo.ai/docs/mdx/collections
|
|
6
|
+
export const docs = defineDocs({
|
|
7
|
+
dir: 'content/docs',
|
|
8
|
+
docs: {
|
|
9
|
+
schema: pageSchema,
|
|
10
|
+
postprocess: {
|
|
11
|
+
includeProcessedMarkdown: true,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
meta: {
|
|
15
|
+
schema: metaSchema,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default defineConfig({
|
|
20
|
+
mdxOptions: {
|
|
21
|
+
// MDX options
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
6
|
+
"allowJs": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"module": "esnext",
|
|
13
|
+
"moduleResolution": "bundler",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"jsx": "react-jsx",
|
|
17
|
+
"incremental": true,
|
|
18
|
+
"paths": {
|
|
19
|
+
"@/*": ["./*"],
|
|
20
|
+
"@hanzo/docs/mdx:collections/*": ["docs/*"]
|
|
21
|
+
},
|
|
22
|
+
"plugins": [
|
|
23
|
+
{
|
|
24
|
+
"name": "next"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"include": [
|
|
29
|
+
"next-env.d.ts",
|
|
30
|
+
"**/*.ts",
|
|
31
|
+
"**/*.tsx",
|
|
32
|
+
".next/types/**/*.ts",
|
|
33
|
+
".next/dev/types/**/*.ts"
|
|
34
|
+
],
|
|
35
|
+
"exclude": ["node_modules"]
|
|
36
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
This is a Next.js application generated with
|
|
2
|
+
[Create Hanzo Docs](https://github.com/hanzoai/docs).
|
|
3
|
+
|
|
4
|
+
Run development server:
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm run dev
|
|
8
|
+
# or
|
|
9
|
+
pnpm dev
|
|
10
|
+
# or
|
|
11
|
+
yarn dev
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Open http://localhost:3000 with your browser to see the result.
|
|
15
|
+
|
|
16
|
+
## Explore
|
|
17
|
+
|
|
18
|
+
In the project, you can see:
|
|
19
|
+
|
|
20
|
+
- `lib/source.ts`: Code for content source adapter, [`loader()`](https://hanzo-docs.dev/docs/headless/source-api) provides the interface to access your content.
|
|
21
|
+
- `lib/layout.shared.tsx`: Shared options for layouts, optional but preferred to keep.
|
|
22
|
+
|
|
23
|
+
| Route | Description |
|
|
24
|
+
| ------------------------- | ------------------------------------------------------ |
|
|
25
|
+
| `app/(home)` | The route group for your landing page and other pages. |
|
|
26
|
+
| `app/docs` | The documentation layout and pages. |
|
|
27
|
+
| `app/api/search/route.ts` | The Route Handler for search. |
|
|
28
|
+
|
|
29
|
+
### Hanzo Docs MDX
|
|
30
|
+
|
|
31
|
+
A `source.config.ts` config file has been included, you can customise different options like frontmatter schema.
|
|
32
|
+
|
|
33
|
+
Read the [Introduction](https://hanzo-docs.dev/docs/mdx) for further details.
|
|
34
|
+
|
|
35
|
+
## Learn More
|
|
36
|
+
|
|
37
|
+
To learn more about Next.js and Hanzo Docs, take a look at the following
|
|
38
|
+
resources:
|
|
39
|
+
|
|
40
|
+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
|
|
41
|
+
features and API.
|
|
42
|
+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
43
|
+
- [Hanzo Docs](https://hanzo-docs.dev) - learn about Hanzo Docs
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Link from 'next/link';
|
|
2
|
+
|
|
3
|
+
export default function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex flex-col justify-center text-center flex-1">
|
|
6
|
+
<h1 className="text-2xl font-bold mb-4">Hello World</h1>
|
|
7
|
+
<p>
|
|
8
|
+
You can open{' '}
|
|
9
|
+
<Link href="/docs" className="font-medium underline">
|
|
10
|
+
/docs
|
|
11
|
+
</Link>{' '}
|
|
12
|
+
and see the documentation.
|
|
13
|
+
</p>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { getPageImage, source } from '@/lib/source';
|
|
2
|
+
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from '@hanzo/docs-base-ui/layouts/docs/page';
|
|
3
|
+
import { notFound } from 'next/navigation';
|
|
4
|
+
import { getMDXComponents } from '@/mdx-components';
|
|
5
|
+
import type { Metadata } from 'next';
|
|
6
|
+
import { createRelativeLink } from '@hanzo/docs-base-ui/mdx';
|
|
7
|
+
import { LLMCopyButton, ViewOptions } from '@/components/ai/page-actions';
|
|
8
|
+
|
|
9
|
+
export default async function Page(props: PageProps<'/docs/[[...slug]]'>) {
|
|
10
|
+
const params = await props.params;
|
|
11
|
+
const page = source.getPage(params.slug);
|
|
12
|
+
if (!page) notFound();
|
|
13
|
+
|
|
14
|
+
const MDX = page.data.body;
|
|
15
|
+
const gitConfig = {
|
|
16
|
+
user: 'username',
|
|
17
|
+
repo: 'repo',
|
|
18
|
+
branch: 'main',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<DocsPage toc={page.data.toc} full={page.data.full}>
|
|
23
|
+
<DocsTitle>{page.data.title}</DocsTitle>
|
|
24
|
+
<DocsDescription className="mb-0">{page.data.description}</DocsDescription>
|
|
25
|
+
<div className="flex flex-row gap-2 items-center border-b pb-6">
|
|
26
|
+
<LLMCopyButton markdownUrl={`${page.url}.mdx`} />
|
|
27
|
+
<ViewOptions
|
|
28
|
+
markdownUrl={`${page.url}.mdx`}
|
|
29
|
+
// update it to match your repo
|
|
30
|
+
githubUrl={`https://github.com/${gitConfig.user}/${gitConfig.repo}/blob/${gitConfig.branch}/docs/content/docs/${page.path}`}
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
<DocsBody>
|
|
34
|
+
<MDX
|
|
35
|
+
components={getMDXComponents({
|
|
36
|
+
// this allows you to link to other pages with relative file paths
|
|
37
|
+
a: createRelativeLink(source, page),
|
|
38
|
+
})}
|
|
39
|
+
/>
|
|
40
|
+
</DocsBody>
|
|
41
|
+
</DocsPage>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export async function generateStaticParams() {
|
|
46
|
+
return source.generateParams();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function generateMetadata(props: PageProps<'/docs/[[...slug]]'>): Promise<Metadata> {
|
|
50
|
+
const params = await props.params;
|
|
51
|
+
const page = source.getPage(params.slug);
|
|
52
|
+
if (!page) notFound();
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
title: page.data.title,
|
|
56
|
+
description: page.data.description,
|
|
57
|
+
openGraph: {
|
|
58
|
+
images: getPageImage(page).url,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { source } from '@/lib/source';
|
|
2
|
+
import { DocsLayout } from '@hanzo/docs/ui/layouts/docs';
|
|
3
|
+
import { baseOptions } from '@/lib/layout.shared';
|
|
4
|
+
|
|
5
|
+
export default function Layout({ children }: LayoutProps<'/docs'>) {
|
|
6
|
+
return (
|
|
7
|
+
<DocsLayout tree={source.getPageTree()} {...baseOptions()}>
|
|
8
|
+
{children}
|
|
9
|
+
</DocsLayout>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RootProvider } from '@hanzo/docs/ui/provider/next';
|
|
2
|
+
import './global.css';
|
|
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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getLLMText, source } from '@/lib/source';
|
|
2
|
+
|
|
3
|
+
export const revalidate = false;
|
|
4
|
+
|
|
5
|
+
export async function GET() {
|
|
6
|
+
const scan = source.getPages().map(getLLMText);
|
|
7
|
+
const scanned = await Promise.all(scan);
|
|
8
|
+
|
|
9
|
+
return new Response(scanned.join('\n\n'));
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getPageImage, source } from '@/lib/source';
|
|
2
|
+
import { notFound } from 'next/navigation';
|
|
3
|
+
import { ImageResponse } from 'next/og';
|
|
4
|
+
import { generate as DefaultImage } from '@hanzo/docs/ui/og';
|
|
5
|
+
|
|
6
|
+
export const revalidate = false;
|
|
7
|
+
|
|
8
|
+
export async function GET(_req: Request, { params }: RouteContext<'/og/docs/[...slug]'>) {
|
|
9
|
+
const { slug } = await params;
|
|
10
|
+
const page = source.getPage(slug.slice(0, -1));
|
|
11
|
+
if (!page) notFound();
|
|
12
|
+
|
|
13
|
+
return new ImageResponse(
|
|
14
|
+
<DefaultImage title={page.data.title} description={page.data.description} site="My App" />,
|
|
15
|
+
{
|
|
16
|
+
width: 1200,
|
|
17
|
+
height: 630,
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function generateStaticParams() {
|
|
23
|
+
return source.getPages().map((page) => ({
|
|
24
|
+
lang: page.locale,
|
|
25
|
+
slug: getPageImage(page).segments,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Hello World
|
|
3
|
+
description: Your first document
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Welcome to the docs! You can start writing documents in `/content/docs`.
|
|
7
|
+
|
|
8
|
+
## What is Next?
|
|
9
|
+
|
|
10
|
+
<Cards>
|
|
11
|
+
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
|
|
12
|
+
<Card title="Learn more about Hanzo Docs" href="https://hanzo-docs.dev" />
|
|
13
|
+
</Cards>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Components
|
|
3
|
+
description: Components
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Code Block
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
console.log('Hello World');
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Cards
|
|
13
|
+
|
|
14
|
+
<Cards>
|
|
15
|
+
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
|
|
16
|
+
<Card title="Learn more about Hanzo Docs" href="https://hanzo-docs.dev" />
|
|
17
|
+
</Cards>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# deps
|
|
2
|
+
/node_modules
|
|
3
|
+
|
|
4
|
+
# generated content
|
|
5
|
+
docs
|
|
6
|
+
|
|
7
|
+
# test & build
|
|
8
|
+
/coverage
|
|
9
|
+
/.next/
|
|
10
|
+
/out/
|
|
11
|
+
/build
|
|
12
|
+
*.tsbuildinfo
|
|
13
|
+
|
|
14
|
+
# misc
|
|
15
|
+
.DS_Store
|
|
16
|
+
*.pem
|
|
17
|
+
/.pnp
|
|
18
|
+
.pnp.js
|
|
19
|
+
npm-debug.log*
|
|
20
|
+
yarn-debug.log*
|
|
21
|
+
yarn-error.log*
|
|
22
|
+
|
|
23
|
+
# others
|
|
24
|
+
.env*.local
|
|
25
|
+
.vercel
|
|
26
|
+
next-env.d.ts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { twMerge as cn } from 'tailwind-merge';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { docs } from '@hanzo/docs/mdx:collections/server';
|
|
2
|
+
import { type InferPageType, loader } from '@hanzo/docs/core/source';
|
|
3
|
+
import { lucideIconsPlugin } from '@hanzo/docs/core/source/lucide-icons';
|
|
4
|
+
|
|
5
|
+
// See https://hanzo.ai/docs/headless/source-api for more info
|
|
6
|
+
export const source = loader({
|
|
7
|
+
baseUrl: '/docs',
|
|
8
|
+
source: docs.toSource(),
|
|
9
|
+
plugins: [lucideIconsPlugin()],
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export function getPageImage(page: InferPageType<typeof source>) {
|
|
13
|
+
const segments = [...page.slugs, 'image.png'];
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
segments,
|
|
17
|
+
url: `/og/docs/${segments.join('/')}`,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function getLLMText(page: InferPageType<typeof source>) {
|
|
22
|
+
const processed = await page.data.getText('processed');
|
|
23
|
+
|
|
24
|
+
return `# ${page.data.title}
|
|
25
|
+
|
|
26
|
+
${processed}`;
|
|
27
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createMDX } from 'hanzo-docs-mdx/next';
|
|
2
|
+
|
|
3
|
+
const withMDX = createMDX();
|
|
4
|
+
|
|
5
|
+
/** @type {import('next').NextConfig} */
|
|
6
|
+
const config = {
|
|
7
|
+
reactStrictMode: true,
|
|
8
|
+
async rewrites() {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
source: '/docs/:path*.mdx',
|
|
12
|
+
destination: '/llms.mdx/docs/:path*',
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default withMDX(config);
|