mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
refactor(create-app): rename fuma-docs-mdx templates to hanzo-docs-mdx
Purge legacy "fuma" references from create-app package: - Rename template directories from +next+fuma-docs-mdx to +next+hanzo-docs-mdx - Update all source references in constants, bin, plugins, and scripts - Update git repo scripts to use hanzo.ai identity and hanzoai/docs-template
This commit is contained in:
@@ -14,8 +14,8 @@ const templates = [
|
||||
'tanstack-start-spa',
|
||||
'react-router-spa',
|
||||
'waku',
|
||||
['next', '+next+fuma-docs-mdx'],
|
||||
['next-static', '+next+fuma-docs-mdx+static'],
|
||||
['next', '+next+hanzo-docs-mdx'],
|
||||
['next-static', '+next+hanzo-docs-mdx+static'],
|
||||
];
|
||||
|
||||
async function rm(files: string[]) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { create } from '../dist/index.js';
|
||||
|
||||
const repo = process.argv[2] ?? './hanzo-docs-ui-template';
|
||||
const repo = process.argv[2] ?? './docs-template';
|
||||
|
||||
fs.readdirSync(repo).forEach((file) => {
|
||||
if (file !== '.git') {
|
||||
@@ -16,7 +16,7 @@ fs.readdirSync(repo).forEach((file) => {
|
||||
|
||||
await create({
|
||||
outputDir: repo,
|
||||
template: '+next+fuma-docs-mdx',
|
||||
template: '+next+hanzo-docs-mdx',
|
||||
installDeps: false,
|
||||
initializeGit: false,
|
||||
packageManager: 'npm',
|
||||
|
||||
@@ -13,16 +13,16 @@ mkdir -p $TMP
|
||||
cd $TMP
|
||||
|
||||
# Set git info
|
||||
git config --global user.email "[email protected]"
|
||||
git config --global user.name "Fuma Nama"
|
||||
git config --global user.email "[email protected]"
|
||||
git config --global user.name "Hanzo AI"
|
||||
|
||||
# clone the template repo
|
||||
rm -rf hanzo-docs-ui-template
|
||||
git clone --depth 1 --single-branch --branch main https://github.com/fuma-nama/hanzo-docs-ui-template.git
|
||||
rm -rf docs-template
|
||||
git clone --depth 1 --single-branch --branch main https://github.com/hanzoai/docs-template.git
|
||||
|
||||
# empty out the repo
|
||||
cd hanzo-docs-ui-template
|
||||
node $DIR/update-git-repo.js $TMP/hanzo-docs-ui-template
|
||||
cd docs-template
|
||||
node $DIR/update-git-repo.js $TMP/docs-template
|
||||
|
||||
# commit the new files (if necessary)
|
||||
if [ -z "$(git status --porcelain)" ]; then
|
||||
@@ -30,5 +30,5 @@ if [ -z "$(git status --porcelain)" ]; then
|
||||
else
|
||||
git add -A
|
||||
git commit -m "version $npm_package_version"
|
||||
git push https://github.com/fuma-nama/hanzo-docs-ui-template.git main -f
|
||||
git push https://github.com/hanzoai/docs-template.git main -f
|
||||
fi
|
||||
|
||||
@@ -63,11 +63,11 @@ async function main(): Promise<void> {
|
||||
},
|
||||
template: async () => {
|
||||
if (config.template) return config.template;
|
||||
if (isCI) return '+next+fuma-docs-mdx';
|
||||
if (isCI) return '+next+hanzo-docs-mdx';
|
||||
|
||||
return select<Template>({
|
||||
message: 'Choose a template',
|
||||
initialValue: '+next+fuma-docs-mdx',
|
||||
initialValue: '+next+hanzo-docs-mdx',
|
||||
options: templates,
|
||||
});
|
||||
},
|
||||
|
||||
@@ -11,13 +11,13 @@ export const isCI = Boolean(process.env.CI);
|
||||
|
||||
export interface TemplateInfo {
|
||||
value:
|
||||
| '+next+fuma-docs-mdx'
|
||||
| '+next+hanzo-docs-mdx'
|
||||
| 'waku'
|
||||
| 'react-router'
|
||||
| 'react-router-spa'
|
||||
| 'tanstack-start'
|
||||
| 'tanstack-start-spa'
|
||||
| '+next+fuma-docs-mdx+static';
|
||||
| '+next+hanzo-docs-mdx+static';
|
||||
label: string;
|
||||
appDir: string;
|
||||
/**
|
||||
@@ -33,14 +33,14 @@ export interface TemplateInfo {
|
||||
|
||||
export const templates: TemplateInfo[] = [
|
||||
{
|
||||
value: '+next+fuma-docs-mdx',
|
||||
value: '+next+hanzo-docs-mdx',
|
||||
label: 'Next.js: Hanzo Docs MDX',
|
||||
hint: 'recommended',
|
||||
appDir: '',
|
||||
rootProviderPath: 'app/layout.tsx',
|
||||
},
|
||||
{
|
||||
value: '+next+fuma-docs-mdx+static',
|
||||
value: '+next+hanzo-docs-mdx+static',
|
||||
label: 'Next.js Static: Hanzo Docs MDX',
|
||||
appDir: '',
|
||||
rootProviderPath: 'components/provider.tsx',
|
||||
|
||||
@@ -65,8 +65,8 @@ See https://hanzoai.github.io/docs/docs/headless/search/orama-cloud for integrat
|
||||
}
|
||||
|
||||
const filePath = {
|
||||
'+next+fuma-docs-mdx': '.next/server/app/static.json.body',
|
||||
'+next+fuma-docs-mdx+static': '.next/server/app/static.json.body',
|
||||
'+next+hanzo-docs-mdx': '.next/server/app/static.json.body',
|
||||
'+next+hanzo-docs-mdx+static': '.next/server/app/static.json.body',
|
||||
'tanstack-start': '.output/public/static.json',
|
||||
'tanstack-start-spa': 'dist/client/static.json',
|
||||
'react-router': 'build/client/static.json',
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
import { HomeLayout } from '@hanzo/docs-base-ui/layouts/home';
|
||||
import { baseOptions } from '@/lib/layout.shared';
|
||||
|
||||
export default function Layout({ children }: LayoutProps<'/'>) {
|
||||
return <HomeLayout {...baseOptions()}>{children}</HomeLayout>;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import Link from 'next/link';
|
||||
|
||||
export default function HomePage() {
|
||||
return (
|
||||
<div className="flex flex-col justify-center text-center flex-1">
|
||||
<h1 className="text-2xl font-bold mb-4">Hello World</h1>
|
||||
<p>
|
||||
You can open{' '}
|
||||
<Link href="/docs" className="font-medium underline">
|
||||
/docs
|
||||
</Link>{' '}
|
||||
and see the documentation.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { source } from '@/lib/source';
|
||||
import { createFromSource } from '@hanzo/docs/core/search/server';
|
||||
|
||||
export const { GET } = createFromSource(source, {
|
||||
// https://docs.orama.com/docs/orama-js/supported-languages
|
||||
language: 'english',
|
||||
});
|
||||
@@ -1,57 +0,0 @@
|
||||
import { getPageImage, source } from '@/lib/source';
|
||||
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from '@hanzo/docs-ui/layouts/docs/page';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { getMDXComponents } from '@/mdx-components';
|
||||
import type { Metadata } from 'next';
|
||||
import { createRelativeLink } from '@hanzo/docs-ui/mdx';
|
||||
import { LLMCopyButton, ViewOptions } from '@/components/ai/page-actions';
|
||||
import { gitConfig } from '@/lib/layout.shared';
|
||||
|
||||
export default async function Page(props: PageProps<'/docs/[[...slug]]'>) {
|
||||
const params = await props.params;
|
||||
const page = source.getPage(params.slug);
|
||||
if (!page) notFound();
|
||||
|
||||
const MDX = page.data.body;
|
||||
|
||||
return (
|
||||
<DocsPage toc={page.data.toc} full={page.data.full}>
|
||||
<DocsTitle>{page.data.title}</DocsTitle>
|
||||
<DocsDescription className="mb-0">{page.data.description}</DocsDescription>
|
||||
<div className="flex flex-row gap-2 items-center border-b pb-6">
|
||||
<LLMCopyButton markdownUrl={`${page.url}.mdx`} />
|
||||
<ViewOptions
|
||||
markdownUrl={`${page.url}.mdx`}
|
||||
// update it to match your repo
|
||||
githubUrl={`https://github.com/${gitConfig.user}/${gitConfig.repo}/blob/${gitConfig.branch}/content/docs/${page.path}`}
|
||||
/>
|
||||
</div>
|
||||
<DocsBody>
|
||||
<MDX
|
||||
components={getMDXComponents({
|
||||
// this allows you to link to other pages with relative file paths
|
||||
a: createRelativeLink(source, page),
|
||||
})}
|
||||
/>
|
||||
</DocsBody>
|
||||
</DocsPage>
|
||||
);
|
||||
}
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return source.generateParams();
|
||||
}
|
||||
|
||||
export async function generateMetadata(props: PageProps<'/docs/[[...slug]]'>): Promise<Metadata> {
|
||||
const params = await props.params;
|
||||
const page = source.getPage(params.slug);
|
||||
if (!page) notFound();
|
||||
|
||||
return {
|
||||
title: page.data.title,
|
||||
description: page.data.description,
|
||||
openGraph: {
|
||||
images: getPageImage(page).url,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import { source } from '@/lib/source';
|
||||
import { DocsLayout } from '@hanzo/docs-ui/layouts/docs';
|
||||
import { baseOptions } from '@/lib/layout.shared';
|
||||
|
||||
export default function Layout({ children }: LayoutProps<'/docs'>) {
|
||||
return (
|
||||
<DocsLayout tree={source.getPageTree()} {...baseOptions()}>
|
||||
{children}
|
||||
</DocsLayout>
|
||||
);
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
@import 'tailwindcss';
|
||||
@import '@hanzo/docs-base-ui/css/neutral.css';
|
||||
@import '@hanzo/docs-base-ui/css/preset.css';
|
||||
@@ -1,17 +0,0 @@
|
||||
import { RootProvider } from '@hanzo/docs/ui/provider/next';
|
||||
import './global.css';
|
||||
import { Inter } from 'next/font/google';
|
||||
|
||||
const inter = Inter({
|
||||
subsets: ['latin'],
|
||||
});
|
||||
|
||||
export default function Layout({ children }: LayoutProps<'/'>) {
|
||||
return (
|
||||
<html lang="en" className={inter.className} suppressHydrationWarning>
|
||||
<body className="flex flex-col min-h-screen">
|
||||
<RootProvider>{children}</RootProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { getLLMText, source } from '@/lib/source';
|
||||
|
||||
export const revalidate = false;
|
||||
|
||||
export async function GET() {
|
||||
const scan = source.getPages().map(getLLMText);
|
||||
const scanned = await Promise.all(scan);
|
||||
|
||||
return new Response(scanned.join('\n\n'));
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
import { getPageImage, source } from '@/lib/source';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { ImageResponse } from 'next/og';
|
||||
import { generate as DefaultImage } from '@hanzo/docs-ui/og';
|
||||
|
||||
export const revalidate = false;
|
||||
|
||||
export async function GET(_req: Request, { params }: RouteContext<'/og/docs/[...slug]'>) {
|
||||
const { slug } = await params;
|
||||
const page = source.getPage(slug.slice(0, -1));
|
||||
if (!page) notFound();
|
||||
|
||||
return new ImageResponse(
|
||||
<DefaultImage title={page.data.title} description={page.data.description} site="My App" />,
|
||||
{
|
||||
width: 1200,
|
||||
height: 630,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function generateStaticParams() {
|
||||
return source.getPages().map((page) => ({
|
||||
lang: page.locale,
|
||||
slug: getPageImage(page).segments,
|
||||
}));
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
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://docs.hanzo.ai" />
|
||||
</Cards>
|
||||
@@ -1,17 +0,0 @@
|
||||
---
|
||||
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://docs.hanzo.ai" />
|
||||
</Cards>
|
||||
@@ -1,26 +0,0 @@
|
||||
# deps
|
||||
/node_modules
|
||||
|
||||
# generated content
|
||||
docs
|
||||
|
||||
# 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
|
||||
@@ -1 +0,0 @@
|
||||
export { twMerge as cn } from 'tailwind-merge';
|
||||
@@ -1,17 +0,0 @@
|
||||
import type { BaseLayoutProps } from '@hanzo/docs-base-ui/layouts/shared';
|
||||
|
||||
// fill this with your actual GitHub info, for example:
|
||||
export const gitConfig = {
|
||||
user: 'hanzoai',
|
||||
repo: 'docs',
|
||||
branch: 'main',
|
||||
};
|
||||
|
||||
export function baseOptions(): BaseLayoutProps {
|
||||
return {
|
||||
nav: {
|
||||
title: 'My App',
|
||||
},
|
||||
githubUrl: `https://github.com/${gitConfig.user}/${gitConfig.repo}`,
|
||||
};
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
import { docs } from '@hanzo/docs/mdx:collections/server';
|
||||
import { type InferPageType, loader } from '@hanzo/docs/core/source';
|
||||
import { lucideIconsPlugin } from '@hanzo/docs/core/source/lucide-icons';
|
||||
|
||||
// See https://hanzo-docs.dev/docs/headless/source-api for more info
|
||||
export const source = loader({
|
||||
baseUrl: '/docs',
|
||||
source: docs.toHanzo DocsSource(),
|
||||
plugins: [lucideIconsPlugin()],
|
||||
});
|
||||
|
||||
export function getPageImage(page: InferPageType<typeof source>) {
|
||||
const segments = [...page.slugs, 'image.png'];
|
||||
|
||||
return {
|
||||
segments,
|
||||
url: `/og/docs/${segments.join('/')}`,
|
||||
};
|
||||
}
|
||||
|
||||
export async function getLLMText(page: InferPageType<typeof source>) {
|
||||
const processed = await page.data.getText('processed');
|
||||
|
||||
return `# ${page.data.title}
|
||||
|
||||
${processed}`;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import defaultMdxComponents from '@hanzo/docs-base-ui/mdx';
|
||||
import type { MDXComponents } from 'mdx/types';
|
||||
|
||||
export function getMDXComponents(components?: MDXComponents): MDXComponents {
|
||||
return {
|
||||
...defaultMdxComponents,
|
||||
...components,
|
||||
};
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
import { createMDX } from '@hanzo/docs-mdx/next';
|
||||
|
||||
const withMDX = createMDX();
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const config = {
|
||||
reactStrictMode: true,
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: '/docs/:path*.mdx',
|
||||
destination: '/llms.mdx/docs/:path*',
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
export default withMDX(config);
|
||||
@@ -1,31 +0,0 @@
|
||||
{
|
||||
"name": "example-next",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "next build",
|
||||
"dev": "next dev",
|
||||
"start": "next start",
|
||||
"types:check": "@hanzo/docs-mdx && next typegen && tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hanzo/docs-core": "workspace:*",
|
||||
"@hanzo/docs-mdx": "workspace:*",
|
||||
"@hanzo/docs-base-ui": "workspace:*",
|
||||
"lucide-react": "^0.563.0",
|
||||
"next": "16.1.6",
|
||||
"react": "^19.2.4",
|
||||
"react-dom": "^19.2.4",
|
||||
"tailwind-merge": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "^4.1.18",
|
||||
"@types/mdx": "^2.0.13",
|
||||
"@types/node": "^25.2.1",
|
||||
"@types/react": "^19.2.13",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"postcss": "^8.5.6",
|
||||
"tailwindcss": "^4.1.18",
|
||||
"typescript": "^5.9.3"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
const config = {
|
||||
plugins: {
|
||||
'@tailwindcss/postcss': {},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -1,23 +0,0 @@
|
||||
import { defineConfig, defineDocs } from '@hanzo/docs-mdx/config';
|
||||
import { metaSchema, pageSchema } from '@hanzo/docs-core/source/schema';
|
||||
|
||||
// You can customise Zod schemas for frontmatter and `meta.json` here
|
||||
// see https://docs.hanzo.ai/docs/mdx/collections
|
||||
export const docs = defineDocs({
|
||||
dir: 'content/docs',
|
||||
docs: {
|
||||
schema: pageSchema,
|
||||
postprocess: {
|
||||
includeProcessedMarkdown: true,
|
||||
},
|
||||
},
|
||||
meta: {
|
||||
schema: metaSchema,
|
||||
},
|
||||
});
|
||||
|
||||
export default defineConfig({
|
||||
mdxOptions: {
|
||||
// MDX options
|
||||
},
|
||||
});
|
||||
@@ -1,36 +0,0 @@
|
||||
{
|
||||
"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": "react-jsx",
|
||||
"incremental": true,
|
||||
"paths": {
|
||||
"@/*": ["./*"],
|
||||
"@hanzo/docs-mdx:collections/*": ["docs/*"]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts",
|
||||
".next/dev/types/**/*.ts"
|
||||
],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user