This commit is contained in:
Bereket Engida
2024-11-18 19:27:50 +03:00
parent 97597ecffe
commit a555d57c01
29 changed files with 11090 additions and 44 deletions

View File

@@ -1,4 +1,4 @@
import { source } from "@/app/source"; import { source, openapi } from "@/app/source";
import { DocsPage, DocsBody, DocsTitle } from "fumadocs-ui/page"; import { DocsPage, DocsBody, DocsTitle } from "fumadocs-ui/page";
import { notFound } from "next/navigation"; import { notFound } from "next/navigation";
import { absoluteUrl } from "@/lib/utils"; import { absoluteUrl } from "@/lib/utils";
@@ -76,6 +76,7 @@ export default async function Page({
iframe: (props) => ( iframe: (props) => (
<iframe {...props} className="w-full h-[500px]" /> <iframe {...props} className="w-full h-[500px]" />
), ),
APIPage: openapi.APIPage,
}} }}
/> />
</DocsBody> </DocsBody>
@@ -84,48 +85,48 @@ export default async function Page({
} }
export async function generateStaticParams() { export async function generateStaticParams() {
const res = source.getPages().map((page) => ({ // const res = source.getPages().map((page) => ({
slug: page.slugs, // slug: page.slugs,
})); // }));
return res; return source.generateParams();
} }
export async function generateMetadata({ // export async function generateMetadata({
params, // params,
}: { params: Promise<{ slug?: string[] }> }) { // }: { params: Promise<{ slug?: string[] }> }) {
const { slug } = await params; // const { slug } = await params;
const page = source.getPage(slug); // const page = source.getPage(slug);
if (page == null) notFound(); // if (page == null) notFound();
const baseUrl = process.env.NEXT_PUBLIC_URL || process.env.VERCEL_URL; // const baseUrl = process.env.NEXT_PUBLIC_URL || process.env.VERCEL_URL;
const url = new URL(`${baseUrl}/api/og`); // const url = new URL(`${baseUrl}/api/og`);
const { title, description } = page.data; // const { title, description } = page.data;
const pageSlug = page.file.path; // const pageSlug = page.file.path;
url.searchParams.set("type", "Documentation"); // url.searchParams.set("type", "Documentation");
url.searchParams.set("mode", "dark"); // url.searchParams.set("mode", "dark");
url.searchParams.set("heading", `${title}`); // url.searchParams.set("heading", `${title}`);
return { // return {
title, // title,
description, // description,
openGraph: { // openGraph: {
title, // title,
description, // description,
type: "website", // type: "website",
url: absoluteUrl(`docs/${pageSlug}`), // url: absoluteUrl(`docs/${pageSlug}`),
images: [ // images: [
{ // {
url: url.toString(), // url: url.toString(),
width: 1200, // width: 1200,
height: 630, // height: 630,
alt: title, // alt: title,
}, // },
], // ],
}, // },
twitter: { // twitter: {
card: "summary_large_image", // card: "summary_large_image",
title, // title,
description, // description,
images: [url.toString()], // images: [url.toString()],
}, // },
}; // };
} // }

View File

@@ -1,13 +1,18 @@
import { docs, meta, changelog as _changelog } from "@/.source"; import { docs, meta, changelog as _changelog } from "@/.source";
import { createMDXSource } from "fumadocs-mdx"; import { createMDXSource } from "fumadocs-mdx";
import { loader } from "fumadocs-core/source"; import { loader } from "fumadocs-core/source";
import { attachFile, createOpenAPI } from "fumadocs-openapi/server";
export const source = loader({ export const source = loader({
baseUrl: "/docs", baseUrl: "/docs",
source: createMDXSource(docs, meta), source: createMDXSource(docs, meta),
pageTree: {
attachFile,
},
}); });
export const changelog = loader({ export const changelog = loader({
baseUrl: "/changelog", baseUrl: "/changelog",
source: createMDXSource(_changelog, meta), source: createMDXSource(_changelog, meta),
}); });
export const openapi = createOpenAPI();

View File

@@ -0,0 +1,13 @@
---
title: Link social account
full: true
_openapi:
method: POST
route: /link-social
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/link-social","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: List all accounts
full: true
_openapi:
method: GET
route: /list-accounts
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/list-accounts","method":"get"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Callback
full: true
_openapi:
method: GET
route: /callback/:id
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/callback/:id","method":"get"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Send verification email
full: true
_openapi:
method: POST
route: /send-verification-email
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/send-verification-email","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Verify email
full: true
_openapi:
method: GET
route: /verify-email
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/verify-email","method":"get"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Forget password
full: true
_openapi:
method: POST
route: /forget-password
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/forget-password","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Reset password with token
full: true
_openapi:
method: GET
route: /reset-password/:token
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/reset-password/:token","method":"get"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Reset password
full: true
_openapi:
method: POST
route: /reset-password
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/reset-password","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Get current session
full: true
_openapi:
method: GET
route: /get-session
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/get-session","method":"get"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: List all sessions
full: true
_openapi:
method: GET
route: /list-sessions
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/list-sessions","method":"get"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Revoke other sessions
full: true
_openapi:
method: POST
route: /revoke-other-sessions
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/revoke-other-sessions","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Revoke a session
full: true
_openapi:
method: POST
route: /revoke-session
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/revoke-session","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Revoke all sessions
full: true
_openapi:
method: POST
route: /revoke-sessions
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/revoke-sessions","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Sign in with email
full: true
_openapi:
method: POST
route: /sign-in/email
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/sign-in/email","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Sign in with social account
full: true
_openapi:
method: POST
route: /sign-in/social
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/sign-in/social","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Sign out
full: true
_openapi:
method: POST
route: /sign-out
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/sign-out","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Sign up with email
full: true
_openapi:
method: POST
route: /sign-up/email
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/sign-up/email","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Change email
full: true
_openapi:
method: POST
route: /change-email
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/change-email","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Change password
full: true
_openapi:
method: POST
route: /change-password
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/change-password","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Delete user
full: true
_openapi:
method: POST
route: /delete-user
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/delete-user","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Set password
full: true
_openapi:
method: POST
route: /set-password
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/set-password","method":"post"}]} hasHead={false} />

View File

@@ -0,0 +1,13 @@
---
title: Update user
full: true
_openapi:
method: POST
route: /update-user
toc: []
structuredData:
headings: []
contents: []
---
<APIPage document={"./open-api.json"} operations={[{"path":"/update-user","method":"post"}]} hasHead={false} />

2126
docs/open-api.json Normal file

File diff suppressed because it is too large Load Diff

7266
docs/openapi.json Normal file

File diff suppressed because it is too large Load Diff

1341
docs/openapi.yml Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,7 @@
"build": "next build", "build": "next build",
"dev": "next dev", "dev": "next dev",
"start": "next start", "start": "next start",
"build:docs": "node ./scripts/generate-docs.mjs",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"postinstall": "fumadocs-mdx" "postinstall": "fumadocs-mdx"
}, },
@@ -60,6 +61,7 @@
"fumadocs-core": "14.0.2", "fumadocs-core": "14.0.2",
"fumadocs-docgen": "^1.1.0", "fumadocs-docgen": "^1.1.0",
"fumadocs-mdx": "11.1.0", "fumadocs-mdx": "11.1.0",
"fumadocs-openapi": "^5.7.0",
"fumadocs-twoslash": "^1.1.2", "fumadocs-twoslash": "^1.1.2",
"fumadocs-typescript": "^3.0.2", "fumadocs-typescript": "^3.0.2",
"fumadocs-ui": "14.0.2", "fumadocs-ui": "14.0.2",
@@ -82,6 +84,7 @@
"recharts": "^2.12.7", "recharts": "^2.12.7",
"rehype-mermaid": "^2.1.0", "rehype-mermaid": "^2.1.0",
"remark-codesandbox": "^0.10.1", "remark-codesandbox": "^0.10.1",
"rimraf": "^6.0.1",
"sonner": "^1.5.0", "sonner": "^1.5.0",
"tailwind-merge": "^2.5.2", "tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7", "tailwindcss-animate": "^1.0.7",

View File

@@ -0,0 +1,18 @@
import * as OpenAPI from 'fumadocs-openapi';
import { rimrafSync } from 'rimraf';
const out = './content/docs/(api)';
// clean generated files
rimrafSync(out, {
filter(v) {
return !v.endsWith('index.mdx') && !v.endsWith('meta.json');
},
});
void OpenAPI.generateFiles({
// input files
input: ['./open-api.json'],
output: out,
groupBy: 'tag',
})