From cfc947dd8dcd3f8a2ca9a05e9c506cfa5d093453 Mon Sep 17 00:00:00 2001 From: LovelessCodes Date: Wed, 30 Oct 2024 10:28:10 +0100 Subject: [PATCH 1/6] feat: re-use better-auth website/docs design (consistency) --- .vscode/settings.json | 3 + biome.json | 40 +- dev/tsconfig.json | 44 +- doc/app/.DS_Store | Bin 6148 -> 0 bytes doc/app/api/.DS_Store | Bin 6148 -> 0 bytes doc/app/docs/[[...slug]]/page.tsx | 55 - doc/app/docs/layout.tsx | 9 - doc/app/global.css | 52 - doc/app/layout.config.tsx | 31 - doc/app/layout.tsx | 49 - doc/app/page.tsx | 38 - doc/app/source.ts | 10 - doc/components/.DS_Store | Bin 6148 -> 0 bytes doc/components/icons.tsx | 43 - doc/content/docs/index.mdx | 38 - doc/next-env.d.ts | 5 - doc/next.config.mjs | 32 - doc/package.json | 42 - docs/.env.example | 1 + {doc => docs}/.gitignore | 0 docs/.source/index.d.ts | 4 + docs/.source/index.js | 18 + docs/.source/source.config.mjs | 35 + {doc => docs}/README.md | 0 {doc => docs}/app/api/og/inter-bold.woff | Bin {doc => docs}/app/api/og/route.tsx | 0 {doc => docs}/app/api/search/route.ts | 0 docs/app/docs/[[...slug]]/page.tsx | 129 + docs/app/docs/layout.tsx | 19 + docs/app/global.css | 64 + docs/app/layout.config.tsx | 26 + docs/app/layout.tsx | 46 + docs/app/page.tsx | 38 + docs/app/robots.ts | 10 + docs/app/sitemap.ts | 15 + docs/app/source.ts | 13 + docs/bun.lockb | Bin 0 -> 224766 bytes docs/components.json | 20 + docs/components/beta/badge.module.css | 111 + docs/components/beta/badge.tsx | 27 + docs/components/blocks/features.tsx | 125 + docs/components/display-techstack.tsx | 42 + docs/components/features.tsx | 107 + docs/components/fork-button.tsx | 23 + docs/components/github-stat.tsx | 35 + docs/components/icons.tsx | 395 ++ .../components/landing/animated-button.tsx | 0 .../components/landing/box-reveal.tsx | 0 docs/components/landing/grid-pattern.tsx | 129 + {doc => docs}/components/landing/grid.tsx | 0 docs/components/landing/hero.tsx | 426 ++ {doc => docs}/components/landing/ripple.tsx | 0 docs/components/landing/section-svg.tsx | 34 + docs/components/landing/section.tsx | 46 + .../components/landing/typing-animaton.tsx | 0 docs/components/logo.tsx | 21 + docs/components/mdx/database-tables.tsx | 109 + docs/components/nav-bar.tsx | 52 + docs/components/nav-link.tsx | 37 + docs/components/nav-mobile.tsx | 231 + docs/components/ripple.tsx | 46 + docs/components/side-bar.tsx | 184 + docs/components/sidebar-content.tsx | 231 + docs/components/techstack-icons.tsx | 41 + docs/components/theme-toggler.tsx | 59 + docs/components/ui/accordion.tsx | 57 + docs/components/ui/aside-link.tsx | 43 + docs/components/ui/badge.tsx | 36 + {doc => docs}/components/ui/button.tsx | 0 docs/components/ui/card.tsx | 83 + docs/components/ui/cover.tsx | 48 + docs/components/ui/dropdown-menu.tsx | 205 + docs/components/ui/fade-in.tsx | 67 + docs/components/ui/label.tsx | 26 + docs/components/ui/select.tsx | 164 + docs/components/ui/sparkles.tsx | 435 ++ docs/components/ui/table.tsx | 120 + docs/components/ui/toast.tsx | 129 + docs/components/ui/toaster.tsx | 35 + docs/components/ui/tooltip.tsx | 30 + .../content/docs/advanced}/default-types.mdx | 0 .../content/docs/advanced}/fetch-schema.mdx | 0 .../content/docs/advanced}/hooks.mdx | 0 .../content/docs/advanced}/plugins.mdx | 2 +- .../content/docs/helpers}/authorization.mdx | 0 .../docs/helpers}/dynamic-parameters.mdx | 0 .../content/docs/helpers}/handling-errors.mdx | 0 .../docs/helpers}/timeout-and-retry.mdx | 15 +- .../content/docs/installation.mdx | 39 +- docs/content/docs/introduction.mdx | 18 + {doc => docs}/content/docs/meta.json | 0 .../content/docs/plugins}/logger.mdx | 0 .../content/docs/reference/all-options.mdx | 0 .../content/docs/reference}/extra-options.mdx | 2 +- {doc => docs}/extra-content.md | 0 docs/hooks/use-toast.ts | 191 + {doc => docs}/lib/better-fetch-options.ts | 0 docs/lib/constants.ts | 6 + {doc => docs}/lib/example.ts | 0 {doc => docs}/lib/metadata.ts | 0 {doc => docs}/lib/utils.ts | 4 + {doc => docs}/mdx-components.tsx | 0 docs/next.config.mjs | 28 + docs/package.json | 55 + {doc => docs}/postcss.config.js | 0 .../public/android-chrome-192x192.png | Bin .../public/android-chrome-512x512.png | Bin {doc => docs}/public/apple-touch-icon.png | Bin {doc => docs}/public/banner.png | Bin {doc => docs}/public/better-fetch-dark.svg | 0 {doc => docs}/public/better-fetch-light.svg | 0 {doc => docs}/public/favicon-16x16.png | Bin {doc => docs}/public/favicon-32x32.png | Bin {doc => docs}/public/favicon.ico | Bin .../public/favicon/android-chrome-192x192.png | Bin 0 -> 3075 bytes .../public/favicon/android-chrome-512x512.png | Bin 0 -> 11759 bytes docs/public/favicon/apple-touch-icon.png | Bin 0 -> 2790 bytes docs/public/favicon/favicon-16x16.png | Bin 0 -> 260 bytes docs/public/favicon/favicon-32x32.png | Bin 0 -> 428 bytes docs/public/favicon/favicon.ico | Bin 0 -> 15406 bytes .../public/favicon}/site.webmanifest | 0 docs/public/site.webmanifest | 19 + docs/source.config.ts | 31 + {doc => docs}/tailwind.config.js | 25 +- {doc => docs}/tsconfig.json | 0 package.json | 12 +- pnpm-lock.yaml | 4584 +++-------------- 127 files changed, 5667 insertions(+), 4282 deletions(-) delete mode 100644 doc/app/.DS_Store delete mode 100644 doc/app/api/.DS_Store delete mode 100644 doc/app/docs/[[...slug]]/page.tsx delete mode 100644 doc/app/docs/layout.tsx delete mode 100644 doc/app/global.css delete mode 100644 doc/app/layout.config.tsx delete mode 100644 doc/app/layout.tsx delete mode 100644 doc/app/page.tsx delete mode 100644 doc/app/source.ts delete mode 100644 doc/components/.DS_Store delete mode 100644 doc/components/icons.tsx delete mode 100644 doc/content/docs/index.mdx delete mode 100644 doc/next-env.d.ts delete mode 100644 doc/next.config.mjs delete mode 100644 doc/package.json create mode 100644 docs/.env.example rename {doc => docs}/.gitignore (100%) create mode 100644 docs/.source/index.d.ts create mode 100644 docs/.source/index.js create mode 100644 docs/.source/source.config.mjs rename {doc => docs}/README.md (100%) rename {doc => docs}/app/api/og/inter-bold.woff (100%) rename {doc => docs}/app/api/og/route.tsx (100%) rename {doc => docs}/app/api/search/route.ts (100%) create mode 100644 docs/app/docs/[[...slug]]/page.tsx create mode 100644 docs/app/docs/layout.tsx create mode 100644 docs/app/global.css create mode 100644 docs/app/layout.config.tsx create mode 100644 docs/app/layout.tsx create mode 100644 docs/app/page.tsx create mode 100644 docs/app/robots.ts create mode 100644 docs/app/sitemap.ts create mode 100644 docs/app/source.ts create mode 100755 docs/bun.lockb create mode 100644 docs/components.json create mode 100644 docs/components/beta/badge.module.css create mode 100644 docs/components/beta/badge.tsx create mode 100644 docs/components/blocks/features.tsx create mode 100644 docs/components/display-techstack.tsx create mode 100644 docs/components/features.tsx create mode 100644 docs/components/fork-button.tsx create mode 100644 docs/components/github-stat.tsx create mode 100644 docs/components/icons.tsx rename {doc => docs}/components/landing/animated-button.tsx (100%) rename {doc => docs}/components/landing/box-reveal.tsx (100%) create mode 100644 docs/components/landing/grid-pattern.tsx rename {doc => docs}/components/landing/grid.tsx (100%) create mode 100644 docs/components/landing/hero.tsx rename {doc => docs}/components/landing/ripple.tsx (100%) create mode 100644 docs/components/landing/section-svg.tsx create mode 100644 docs/components/landing/section.tsx rename {doc => docs}/components/landing/typing-animaton.tsx (100%) create mode 100644 docs/components/logo.tsx create mode 100644 docs/components/mdx/database-tables.tsx create mode 100644 docs/components/nav-bar.tsx create mode 100644 docs/components/nav-link.tsx create mode 100644 docs/components/nav-mobile.tsx create mode 100644 docs/components/ripple.tsx create mode 100644 docs/components/side-bar.tsx create mode 100644 docs/components/sidebar-content.tsx create mode 100644 docs/components/techstack-icons.tsx create mode 100644 docs/components/theme-toggler.tsx create mode 100644 docs/components/ui/accordion.tsx create mode 100644 docs/components/ui/aside-link.tsx create mode 100644 docs/components/ui/badge.tsx rename {doc => docs}/components/ui/button.tsx (100%) create mode 100644 docs/components/ui/card.tsx create mode 100644 docs/components/ui/cover.tsx create mode 100644 docs/components/ui/dropdown-menu.tsx create mode 100644 docs/components/ui/fade-in.tsx create mode 100644 docs/components/ui/label.tsx create mode 100644 docs/components/ui/select.tsx create mode 100644 docs/components/ui/sparkles.tsx create mode 100644 docs/components/ui/table.tsx create mode 100644 docs/components/ui/toast.tsx create mode 100644 docs/components/ui/toaster.tsx create mode 100644 docs/components/ui/tooltip.tsx rename {doc/content/docs => docs/content/docs/advanced}/default-types.mdx (100%) rename {doc/content/docs => docs/content/docs/advanced}/fetch-schema.mdx (100%) rename {doc/content/docs => docs/content/docs/advanced}/hooks.mdx (100%) rename {doc/content/docs => docs/content/docs/advanced}/plugins.mdx (98%) rename {doc/content/docs => docs/content/docs/helpers}/authorization.mdx (100%) rename {doc/content/docs => docs/content/docs/helpers}/dynamic-parameters.mdx (100%) rename {doc/content/docs => docs/content/docs/helpers}/handling-errors.mdx (100%) rename {doc/content/docs => docs/content/docs/helpers}/timeout-and-retry.mdx (95%) rename doc/content/docs/getting-started.mdx => docs/content/docs/installation.mdx (83%) create mode 100644 docs/content/docs/introduction.mdx rename {doc => docs}/content/docs/meta.json (100%) rename {doc/content/docs/utility => docs/content/docs/plugins}/logger.mdx (100%) rename doc/content/docs/fetch-options.mdx => docs/content/docs/reference/all-options.mdx (100%) rename {doc/content/docs => docs/content/docs/reference}/extra-options.mdx (80%) rename {doc => docs}/extra-content.md (100%) create mode 100644 docs/hooks/use-toast.ts rename {doc => docs}/lib/better-fetch-options.ts (100%) create mode 100644 docs/lib/constants.ts rename {doc => docs}/lib/example.ts (100%) rename {doc => docs}/lib/metadata.ts (100%) rename {doc => docs}/lib/utils.ts (76%) rename {doc => docs}/mdx-components.tsx (100%) create mode 100644 docs/next.config.mjs create mode 100644 docs/package.json rename {doc => docs}/postcss.config.js (100%) rename {doc => docs}/public/android-chrome-192x192.png (100%) rename {doc => docs}/public/android-chrome-512x512.png (100%) rename {doc => docs}/public/apple-touch-icon.png (100%) rename {doc => docs}/public/banner.png (100%) rename {doc => docs}/public/better-fetch-dark.svg (100%) rename {doc => docs}/public/better-fetch-light.svg (100%) rename {doc => docs}/public/favicon-16x16.png (100%) rename {doc => docs}/public/favicon-32x32.png (100%) rename {doc => docs}/public/favicon.ico (100%) create mode 100644 docs/public/favicon/android-chrome-192x192.png create mode 100644 docs/public/favicon/android-chrome-512x512.png create mode 100644 docs/public/favicon/apple-touch-icon.png create mode 100644 docs/public/favicon/favicon-16x16.png create mode 100644 docs/public/favicon/favicon-32x32.png create mode 100644 docs/public/favicon/favicon.ico rename {doc/public => docs/public/favicon}/site.webmanifest (100%) create mode 100644 docs/public/site.webmanifest create mode 100644 docs/source.config.ts rename {doc => docs}/tailwind.config.js (88%) rename {doc => docs}/tsconfig.json (100%) diff --git a/.vscode/settings.json b/.vscode/settings.json index 02abed6..20ba5c9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,5 +9,8 @@ }, "[github-actions-workflow]": { "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "editor.codeActionsOnSave": { + "source.removeUnusedImports": "explicit" } } diff --git a/biome.json b/biome.json index 4acbf67..e61a080 100644 --- a/biome.json +++ b/biome.json @@ -1,15 +1,39 @@ { - "$schema": "https://biomejs.dev/schemas/1.6.3/schema.json", - "organizeImports": { - "enabled": true - }, + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", "formatter": { - "enabled": true + "enabled": true, + "indentStyle": "tab" }, - "files": { - "ignore": ["dist", "node_modules", ".next"] + "organizeImports": { + "enabled": false }, "linter": { - "enabled": false + "enabled": true, + "rules": { + "recommended": false, + "suspicious": { + "noImplicitAnyLet": "warn", + "noDuplicateObjectKeys": "warn" + }, + "performance": { + "noDelete": "error" + }, + "complexity": { + "noUselessSwitchCase": "warn", + "noUselessTypeConstraint": "warn" + } + } + }, + "files": { + "ignore": [ + "dist", + ".next", + ".svelte-kit", + "package.json", + ".contentlayer", + ".turbo", + ".nuxt", + ".source" + ] } } diff --git a/dev/tsconfig.json b/dev/tsconfig.json index 238655f..ffc08ab 100644 --- a/dev/tsconfig.json +++ b/dev/tsconfig.json @@ -1,27 +1,27 @@ { - "compilerOptions": { - // Enable latest features - "lib": ["ESNext", "DOM"], - "target": "ESNext", - "module": "ESNext", - "moduleDetection": "force", - "jsx": "react-jsx", - "allowJs": true, + "compilerOptions": { + // Enable latest features + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, - // Bundler mode - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "noEmit": true, + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, - // Best practices - "strict": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, - // Some stricter flags (disabled by default) - "noUnusedLocals": false, - "noUnusedParameters": false, - "noPropertyAccessFromIndexSignature": false - } + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } } diff --git a/doc/app/.DS_Store b/doc/app/.DS_Store deleted file mode 100644 index 5e617500d74ce1468dad6683b879459c432a946b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKO-sW-5S_6R0=@L;aq;S@cMq||d!au-Z38MaBp}`we~7o>ph)Og;mcfXLdz3n|U?ExNn6EZn+b8divyeXv^6nG5 zp`Pxyx5M{8|2QyhSJ&%pw}z)&UWKRU)3=Ku+x)=xcf(niNTY%p>S#j`Sw%X28FIs# z?`N-{Q?0qrZM#F&F+QtH0aLrV06i~J;7*3I+$AI@7*>W+5e$qq6{x9fR}9v4_=Ck&hEY+|iS2^HR(W@M;Zz;- zhZIg+DSGb;xB|HX6MdY?{(p&IX7rMur}&dA;0pXR1-PhJ^#UJdd+WE)lf5>eU89Lf qT$BL}5~+NUG2$x2s3^0DKcxfxAdm#{&K39t1-<~!PeC96 diff --git a/doc/app/api/.DS_Store b/doc/app/api/.DS_Store deleted file mode 100644 index 3be3f5c87505126780f34264e0d76fd2c671db9a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5T1!e0=@L;G57|>V=rro_yBzXwXL*ZLyF?XQ|>;3;JbM7vBYnFDoIVR zB02-R-|qbEY`&14ED`baaXBU$5mAmN$TH{=QTLiMcNQbd8jHHxsxF&6yY07w>^-BJ zR-4s$wzq%PS9Mv=H}xET`P1a?<@NOad>2#I%Y(M%+(}LEWe8iXg z_IBQ@v$v0-!`!|LbPOO=+j%VIo zURbk3U#L5AGK@YL2nM#4Dg_wl~X*F*Vb>3C$+Xf wyG9cczeWZSjI|U4wG?9_=g5f~&0feD_T<(^b diff --git a/doc/app/docs/[[...slug]]/page.tsx b/doc/app/docs/[[...slug]]/page.tsx deleted file mode 100644 index be35142..0000000 --- a/doc/app/docs/[[...slug]]/page.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { getPage, getPages } from "@/app/source"; -import { Card, Cards } from "fumadocs-ui/components/card"; -import { DocsBody, DocsPage } from "fumadocs-ui/page"; -import type { Metadata } from "next"; -import { notFound } from "next/navigation"; -export default async function Page({ - params, -}: { - params: { slug?: string[] }; -}) { - const page = getPage(params.slug); - - if (page == null) { - notFound(); - } - - const MDX = page.data.exports.default; - - return ( - - -

{page.data.title}

- -
-
- ); -} - -export async function generateStaticParams() { - return getPages().map((page) => ({ - slug: page.slugs, - })); -} - -export function generateMetadata({ params }: { params: { slug?: string[] } }) { - const page = getPage(params.slug); - - if (page == null) notFound(); - - return { - title: page.data.title, - description: page.data.description, - } satisfies Metadata; -} diff --git a/doc/app/docs/layout.tsx b/doc/app/docs/layout.tsx deleted file mode 100644 index a522b81..0000000 --- a/doc/app/docs/layout.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { GitHubLogoIcon } from "@radix-ui/react-icons"; -import { DocsLayout } from "fumadocs-ui/layout"; -import Link from "next/link"; -import type { ReactNode } from "react"; -import { docsOptions } from "../layout.config"; - -export default function Layout({ children }: { children: ReactNode }) { - return {children}; -} diff --git a/doc/app/global.css b/doc/app/global.css deleted file mode 100644 index 6c9dbbd..0000000 --- a/doc/app/global.css +++ /dev/null @@ -1,52 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - - - -@layer base { - :root { - --background: 0 0% 100%; - --foreground: 20 14.3% 4.1%; - --card: 0 0% 100%; - --card-foreground: 20 14.3% 4.1%; - --popover: 0 0% 100%; - --popover-foreground: 20 14.3% 4.1%; - --primary: 24.6 95% 53.1%; - --primary-foreground: 60 9.1% 97.8%; - --secondary: 60 4.8% 95.9%; - --secondary-foreground: 24 9.8% 10%; - --muted: 60 4.8% 95.9%; - --muted-foreground: 25 5.3% 44.7%; - --accent: 60 4.8% 95.9%; - --accent-foreground: 24 9.8% 10%; - --destructive: 0 84.2% 60.2%; - --destructive-foreground: 60 9.1% 97.8%; - --border: 20 5.9% 90%; - --input: 20 5.9% 90%; - --ring: 24.6 95% 53.1%; - --radius: 0.5rem; - } - - .dark { - --background: 20 14.3% 4.1%; - --foreground: 60 9.1% 97.8%; - --card: 20 14.3% 4.1%; - --card-foreground: 60 9.1% 97.8%; - --popover: 20 14.3% 4.1%; - --popover-foreground: 60 9.1% 97.8%; - --primary: 20.5 90.2% 48.2%; - --primary-foreground: 60 9.1% 97.8%; - --secondary: 12 6.5% 15.1%; - --secondary-foreground: 60 9.1% 97.8%; - --muted: 12 6.5% 15.1%; - --muted-foreground: 24 5.4% 63.9%; - --accent: 12 6.5% 15.1%; - --accent-foreground: 60 9.1% 97.8%; - --destructive: 0 72.2% 50.6%; - --destructive-foreground: 60 9.1% 97.8%; - --border: 12 6.5% 15.1%; - --input: 12 6.5% 15.1%; - --ring: 20.5 90.2% 48.2%; - } -} diff --git a/doc/app/layout.config.tsx b/doc/app/layout.config.tsx deleted file mode 100644 index 38e79e9..0000000 --- a/doc/app/layout.config.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { pageTree } from "@/app/source"; -import { GitHubLogoIcon } from "@radix-ui/react-icons"; -import { type BaseLayoutProps, type DocsLayoutProps } from "fumadocs-ui/layout"; -import Link from "next/link"; - -// shared configuration -export const baseOptions: BaseLayoutProps = { - nav: { - title: "Better-Fetch", - transparentMode: "top", - }, - links: [], -}; - -// docs layout configuration -export const docsOptions: DocsLayoutProps = { - ...baseOptions, - tree: pageTree, - nav: { - title: "Better Fetch", - }, - sidebar: { - collapsible: false, - footer: ( - - - - ), - defaultOpenLevel: 1, - }, -}; diff --git a/doc/app/layout.tsx b/doc/app/layout.tsx deleted file mode 100644 index d14d6d6..0000000 --- a/doc/app/layout.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import "./global.css"; -import { RootProvider } from "fumadocs-ui/provider"; -import { Inter } from "next/font/google"; -import type { ReactNode } from "react"; -import "fumadocs-ui/twoslash.css"; -import { baseUrl, createMetadata } from "@/lib/metadata"; - -const inter = Inter({ - subsets: ["latin"], -}); - -export const metadata = createMetadata({ - title: { - template: "%s | Better Fetch", - default: "Better Fetch", - }, - description: "Advanced fetch wrapper for typescript.", - metadataBase: baseUrl, -}); - -export default function Layout({ children }: { children: ReactNode }) { - return ( - - - - - - - - - {children} - - - ); -} diff --git a/doc/app/page.tsx b/doc/app/page.tsx deleted file mode 100644 index 2d5efad..0000000 --- a/doc/app/page.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { Icons } from "@/components/icons"; -import AnimatedGridPattern from "@/components/landing/grid"; -import Ripple from "@/components/landing/ripple"; -import { Button } from "@/components/ui/button"; -import { cn } from "@/lib/utils"; -import { Banner } from "fumadocs-ui/components/banner"; -import Link from "next/link"; - -export default function HomePage() { - return ( -
- -
-

Better Fetch

- -

- Advanced fetch wrapper for typescript with zod schema validations, - pre-defined routes, callbacks, plugins and more. -

-
- - - - - - -
-
-
-
- ); -} diff --git a/doc/app/source.ts b/doc/app/source.ts deleted file mode 100644 index 091b497..0000000 --- a/doc/app/source.ts +++ /dev/null @@ -1,10 +0,0 @@ -//@ts-ignore - this is generated by the build script -import { map } from "@/.map"; -import { loader } from "fumadocs-core/source"; -import { createMDXSource } from "fumadocs-mdx"; - -export const { getPage, getPages, pageTree } = loader({ - baseUrl: "/docs", - rootDir: "docs", - source: createMDXSource(map), -}); diff --git a/doc/components/.DS_Store b/doc/components/.DS_Store deleted file mode 100644 index 469601ec8eb2284327f1f9d1e78269ad3c5d0c3a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKJ5B>J5S7N<)cga)V8@oFFw)2rGq1yKI{DmU0FPBw8-OA*i?nH{s2U z7qVmvDuiH0vY$O4kM~9K*hIv$Z8;$t6H$gH$TH{=QTLh#$yto7Ypm&xR@G`UziE0F z`i&~t`-m#K#?DLH+kd^W?OyB-J?f??mQ}NaC9AHUP9M%*rhQ)JH@r5t!d9DYfn{hw zTUr~7t$uXg>i2WMz1}}RT5gT0o6n42ZQVTbd%HLT&VV!E4E$3DP_sp{V?*zq0cXG& z_+UWJhkz!SCya)AbfD8G0B{Jk3dVZ31O`z6^Muh58VFk`&_X#qG1$VP56Lf27!56) zSTkdtl(~JpaJt!YP) { - return ( - - ); -} - -export const Icons = { - github: () => ( - - - - ), - docs: () => ( - - - - ), - trafficLights: TrafficLightsIcon, -}; diff --git a/doc/content/docs/index.mdx b/doc/content/docs/index.mdx deleted file mode 100644 index 3955d3b..0000000 --- a/doc/content/docs/index.mdx +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: Introduction -description: Getting started with Better Fetch ---- - -Better fetch is advanced fetch wrapper for typescript. It supports error as value, zod schema validations, advanced type inference, pre-defined routes, hooks, plugins and more. Works on the browser, node (version 18+), workers, deno and bun. - -## Features - - - - - - - - - diff --git a/doc/next-env.d.ts b/doc/next-env.d.ts deleted file mode 100644 index 4f11a03..0000000 --- a/doc/next-env.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// -/// - -// NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/doc/next.config.mjs b/doc/next.config.mjs deleted file mode 100644 index 7647b70..0000000 --- a/doc/next.config.mjs +++ /dev/null @@ -1,32 +0,0 @@ -import { rehypeCodeDefaultOptions } from "fumadocs-core/mdx-plugins"; -import { remarkInstall } from "fumadocs-docgen"; -import createMDX from "fumadocs-mdx/config"; -import { transformerTwoslash } from "fumadocs-twoslash"; - -const withMDX = createMDX({ - mdxOptions: { - rehypeCodeOptions: { - transformers: [ - ...rehypeCodeDefaultOptions.transformers, - transformerTwoslash(), - ], - }, - remarkPlugins: [ - [ - remarkInstall, - { - persist: { - id: "persist-install", - }, - }, - ], - ], - }, -}); - -/** @type {import('next').NextConfig} */ -const config = { - reactStrictMode: true, -}; - -export default withMDX(config); diff --git a/doc/package.json b/doc/package.json deleted file mode 100644 index d51518b..0000000 --- a/doc/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "doc", - "version": "0.0.0", - "private": true, - "scripts": { - "build": "next build", - "dev": "next dev", - "start": "next start", - "typecheck": "tsc --noEmit" - }, - "dependencies": { - "@better-fetch/fetch": "^1.1.0", - "@better-fetch/logger": "^1.1.0", - "@radix-ui/react-icons": "^1.3.0", - "@radix-ui/react-slot": "^1.1.0", - "class-variance-authority": "^0.7.0", - "clsx": "^2.1.1", - "framer-motion": "^11.3.2", - "fumadocs-core": "12.4.2", - "fumadocs-docgen": "^1.1.0", - "fumadocs-mdx": "8.2.33", - "fumadocs-openapi": "^3.3.0", - "fumadocs-twoslash": "^1.1.0", - "fumadocs-typescript": "^2.0.1", - "fumadocs-ui": "12.4.2", - "next": "^14.2.4", - "react": "^18.3.1", - "react-dom": "^18.3.1", - "tailwind-merge": "^2.4.0", - "zod": "^3.23.8" - }, - "devDependencies": { - "@types/mdx": "^2.0.13", - "@types/node": "20.14.10", - "@types/react": "^18.3.3", - "@types/react-dom": "^18.3.0", - "autoprefixer": "^10.4.19", - "postcss": "^8.4.39", - "tailwindcss": "^3.4.4", - "typescript": "^5.5.3" - } -} diff --git a/docs/.env.example b/docs/.env.example new file mode 100644 index 0000000..8123582 --- /dev/null +++ b/docs/.env.example @@ -0,0 +1 @@ +NEXT_PUBLIC_URL=http://localhost:3000 \ No newline at end of file diff --git a/doc/.gitignore b/docs/.gitignore similarity index 100% rename from doc/.gitignore rename to docs/.gitignore diff --git a/docs/.source/index.d.ts b/docs/.source/index.d.ts new file mode 100644 index 0000000..9ef0ee8 --- /dev/null +++ b/docs/.source/index.d.ts @@ -0,0 +1,4 @@ +import type { GetOutput } from "fumadocs-mdx/config" +export declare const changelog: GetOutput +export declare const docs: GetOutput +export declare const meta: GetOutput \ No newline at end of file diff --git a/docs/.source/index.js b/docs/.source/index.js new file mode 100644 index 0000000..1eea17d --- /dev/null +++ b/docs/.source/index.js @@ -0,0 +1,18 @@ +import { toRuntime, toRuntimeAsync } from "fumadocs-mdx" +import * as docs_0 from "../content/docs/installation.mdx?collection=docs&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +import * as docs_1 from "../content/docs/introduction.mdx?collection=docs&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +import * as docs_2 from "../content/docs/advanced/default-types.mdx?collection=docs&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +import * as docs_3 from "../content/docs/advanced/fetch-schema.mdx?collection=docs&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +import * as docs_4 from "../content/docs/advanced/hooks.mdx?collection=docs&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +import * as docs_5 from "../content/docs/advanced/plugins.mdx?collection=docs&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +import * as docs_6 from "../content/docs/helpers/authorization.mdx?collection=docs&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +import * as docs_7 from "../content/docs/helpers/dynamic-parameters.mdx?collection=docs&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +import * as docs_8 from "../content/docs/helpers/handling-errors.mdx?collection=docs&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +import * as docs_9 from "../content/docs/helpers/timeout-and-retry.mdx?collection=docs&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +import * as docs_10 from "../content/docs/plugins/logger.mdx?collection=docs&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +import * as docs_11 from "../content/docs/reference/all-options.mdx?collection=docs&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +import * as docs_12 from "../content/docs/reference/extra-options.mdx?collection=docs&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +import * as meta_0 from "../content/docs/meta.json?collection=meta&hash=4e878ae0dc03c3ec08419cdfd45dbe63e97b08e4bff5c536b2e4d68fc35593ea" +export const changelog = []; +export const docs = [toRuntime("doc", docs_0, {"path":"installation.mdx","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/installation.mdx"}), toRuntime("doc", docs_1, {"path":"introduction.mdx","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/introduction.mdx"}), toRuntime("doc", docs_2, {"path":"advanced/default-types.mdx","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/advanced/default-types.mdx"}), toRuntime("doc", docs_3, {"path":"advanced/fetch-schema.mdx","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/advanced/fetch-schema.mdx"}), toRuntime("doc", docs_4, {"path":"advanced/hooks.mdx","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/advanced/hooks.mdx"}), toRuntime("doc", docs_5, {"path":"advanced/plugins.mdx","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/advanced/plugins.mdx"}), toRuntime("doc", docs_6, {"path":"helpers/authorization.mdx","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/helpers/authorization.mdx"}), toRuntime("doc", docs_7, {"path":"helpers/dynamic-parameters.mdx","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/helpers/dynamic-parameters.mdx"}), toRuntime("doc", docs_8, {"path":"helpers/handling-errors.mdx","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/helpers/handling-errors.mdx"}), toRuntime("doc", docs_9, {"path":"helpers/timeout-and-retry.mdx","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/helpers/timeout-and-retry.mdx"}), toRuntime("doc", docs_10, {"path":"plugins/logger.mdx","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/plugins/logger.mdx"}), toRuntime("doc", docs_11, {"path":"reference/all-options.mdx","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/reference/all-options.mdx"}), toRuntime("doc", docs_12, {"path":"reference/extra-options.mdx","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/reference/extra-options.mdx"})]; +export const meta = [toRuntime("meta", meta_0, {"path":"meta.json","absolutePath":"/home/ubuntu/better-fetch/docs/content/docs/meta.json"})]; \ No newline at end of file diff --git a/docs/.source/source.config.mjs b/docs/.source/source.config.mjs new file mode 100644 index 0000000..24c5481 --- /dev/null +++ b/docs/.source/source.config.mjs @@ -0,0 +1,35 @@ +// source.config.ts +import { defineCollections, defineDocs } from "fumadocs-mdx/config"; +import { defineConfig } from "fumadocs-mdx/config"; +import { remarkInstall } from "fumadocs-docgen"; +import { z } from "zod"; +var source_config_default = defineConfig({ + mdxOptions: { + remarkPlugins: [ + [ + remarkInstall, + { + persist: { + id: "persist-install" + } + } + ] + ] + } +}); +var changelog = defineCollections({ + type: "doc", + dir: "./content/changelog", + schema: z.object({ + title: z.string() + }) +}); +var { docs, meta } = defineDocs({ + dir: "./content/docs" +}); +export { + changelog, + source_config_default as default, + docs, + meta +}; diff --git a/doc/README.md b/docs/README.md similarity index 100% rename from doc/README.md rename to docs/README.md diff --git a/doc/app/api/og/inter-bold.woff b/docs/app/api/og/inter-bold.woff similarity index 100% rename from doc/app/api/og/inter-bold.woff rename to docs/app/api/og/inter-bold.woff diff --git a/doc/app/api/og/route.tsx b/docs/app/api/og/route.tsx similarity index 100% rename from doc/app/api/og/route.tsx rename to docs/app/api/og/route.tsx diff --git a/doc/app/api/search/route.ts b/docs/app/api/search/route.ts similarity index 100% rename from doc/app/api/search/route.ts rename to docs/app/api/search/route.ts diff --git a/docs/app/docs/[[...slug]]/page.tsx b/docs/app/docs/[[...slug]]/page.tsx new file mode 100644 index 0000000..e43d227 --- /dev/null +++ b/docs/app/docs/[[...slug]]/page.tsx @@ -0,0 +1,129 @@ +import { source } from "@/app/source"; +import { DocsPage, DocsBody, DocsTitle } from "fumadocs-ui/page"; +import { notFound } from "next/navigation"; +import { absoluteUrl } from "@/lib/utils"; +import DatabaseTable from "@/components/mdx/database-tables"; +import { cn } from "@/lib/utils"; +import { Step, Steps } from "fumadocs-ui/components/steps"; +import { Tab, Tabs } from "fumadocs-ui/components/tabs"; +import { AnimatePresence } from "@/components/ui/fade-in"; +import { TypeTable } from "fumadocs-ui/components/type-table"; +import { Features } from "@/components/blocks/features"; +import { ForkButton } from "@/components/fork-button"; +import Link from "next/link"; +import defaultMdxComponents from "fumadocs-ui/mdx"; +import { AutoTypeTable } from "fumadocs-typescript/ui"; + +export default async function Page({ + params, +}: { + params: Promise<{ slug?: string[] }>; +}) { + const { slug } = await params; + const page = source.getPage(slug); + + if (page == null) { + notFound(); + } + const MDX = page.data.body; + + return ( + , + }} + footer={{ + enabled: false, + }} + > + {page.data.title} + + ) => ( + + ), + Step, + Steps, + Tab, + Tabs, + AnimatePresence, + TypeTable, + Features, + ForkButton, + DatabaseTable, + AutoTypeTable, + iframe: (props) => ( +