@docubook/create 1.9.1 → 1.11.3

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.
Files changed (129) hide show
  1. package/README.md +1 -3
  2. package/package.json +5 -8
  3. package/src/cli/program.js +32 -0
  4. package/src/cli/promptHandler.js +73 -0
  5. package/src/dist/LICENSE +21 -0
  6. package/src/dist/README.md +37 -0
  7. package/src/dist/app/docs/[[...slug]]/page.tsx +105 -0
  8. package/src/dist/app/docs/layout.tsx +16 -0
  9. package/src/dist/app/error.tsx +44 -0
  10. package/src/dist/app/layout.tsx +96 -0
  11. package/src/dist/app/not-found.tsx +19 -0
  12. package/src/dist/app/page.tsx +96 -0
  13. package/src/dist/components/GithubStart.tsx +44 -0
  14. package/src/dist/components/Sponsor.tsx +69 -0
  15. package/src/dist/components/anchor.tsx +84 -0
  16. package/src/dist/components/contexts/theme-provider.tsx +9 -0
  17. package/src/dist/components/docs-breadcrumb.tsx +47 -0
  18. package/src/dist/components/docs-menu.tsx +45 -0
  19. package/src/dist/components/edit-on-github.tsx +33 -0
  20. package/src/dist/components/footer.tsx +85 -0
  21. package/src/dist/components/leftbar.tsx +95 -0
  22. package/src/dist/components/markdown/AccordionMdx.tsx +47 -0
  23. package/src/dist/components/markdown/ButtonMdx.tsx +52 -0
  24. package/src/dist/components/markdown/CardGroupMdx.tsx +28 -0
  25. package/src/dist/components/markdown/CardMdx.tsx +41 -0
  26. package/src/dist/components/markdown/CopyMdx.tsx +33 -0
  27. package/src/dist/components/markdown/ImageMdx.tsx +25 -0
  28. package/src/dist/components/markdown/KeyboardMdx.tsx +102 -0
  29. package/src/dist/components/markdown/LinkMdx.tsx +14 -0
  30. package/src/dist/components/markdown/NoteMdx.tsx +52 -0
  31. package/src/dist/components/markdown/OutletMdx.tsx +29 -0
  32. package/src/dist/components/markdown/PreMdx.tsx +19 -0
  33. package/src/dist/components/markdown/ReleaseMdx.tsx +109 -0
  34. package/src/dist/components/markdown/StepperMdx.tsx +41 -0
  35. package/src/dist/components/markdown/TooltipsMdx.tsx +28 -0
  36. package/src/dist/components/markdown/YoutubeMdx.tsx +22 -0
  37. package/src/dist/components/markdown/mdx-provider.tsx +29 -0
  38. package/src/dist/components/mob-toc.tsx +128 -0
  39. package/src/dist/components/navbar.tsx +87 -0
  40. package/src/dist/components/pagination.tsx +49 -0
  41. package/src/dist/components/scroll-to-top.tsx +86 -0
  42. package/src/dist/components/search.tsx +214 -0
  43. package/src/dist/components/sublink.tsx +133 -0
  44. package/src/dist/components/theme-toggle.tsx +71 -0
  45. package/src/dist/components/toc-observer.tsx +264 -0
  46. package/src/dist/components/toc.tsx +27 -0
  47. package/src/dist/components/typography.tsx +9 -0
  48. package/src/dist/components/ui/accordion.tsx +58 -0
  49. package/src/dist/components/ui/animated-shiny-text.tsx +40 -0
  50. package/src/dist/components/ui/aurora.tsx +45 -0
  51. package/src/dist/components/ui/avatar.tsx +50 -0
  52. package/src/dist/components/ui/badge.tsx +37 -0
  53. package/src/dist/components/ui/breadcrumb.tsx +115 -0
  54. package/src/dist/components/ui/button.tsx +57 -0
  55. package/src/dist/components/ui/card.tsx +76 -0
  56. package/src/dist/components/ui/collapsible.tsx +11 -0
  57. package/src/dist/components/ui/command.tsx +153 -0
  58. package/src/dist/components/ui/dialog.tsx +124 -0
  59. package/src/dist/components/ui/dropdown-menu.tsx +200 -0
  60. package/src/dist/components/ui/icon-cloud.tsx +324 -0
  61. package/src/dist/components/ui/input.tsx +25 -0
  62. package/src/dist/components/ui/interactive-hover-button.tsx +35 -0
  63. package/src/dist/components/ui/popover.tsx +33 -0
  64. package/src/dist/components/ui/scroll-area.tsx +48 -0
  65. package/src/dist/components/ui/separator.tsx +30 -0
  66. package/src/dist/components/ui/sheet.tsx +140 -0
  67. package/src/dist/components/ui/shine-border.tsx +64 -0
  68. package/src/dist/components/ui/skeleton.tsx +15 -0
  69. package/src/dist/components/ui/sonner.tsx +31 -0
  70. package/src/dist/components/ui/table.tsx +117 -0
  71. package/src/dist/components/ui/tabs.tsx +55 -0
  72. package/src/dist/components/ui/toggle-group.tsx +61 -0
  73. package/src/dist/components/ui/toggle.tsx +46 -0
  74. package/src/dist/components.json +17 -0
  75. package/src/dist/contents/docs/getting-started/changelog/index.mdx +512 -0
  76. package/src/dist/contents/docs/getting-started/components/accordion/index.mdx +72 -0
  77. package/src/dist/contents/docs/getting-started/components/button/index.mdx +42 -0
  78. package/src/dist/contents/docs/getting-started/components/card/index.mdx +70 -0
  79. package/src/dist/contents/docs/getting-started/components/card-group/index.mdx +49 -0
  80. package/src/dist/contents/docs/getting-started/components/code-block/index.mdx +41 -0
  81. package/src/dist/contents/docs/getting-started/components/custom/index.mdx +38 -0
  82. package/src/dist/contents/docs/getting-started/components/image/index.mdx +37 -0
  83. package/src/dist/contents/docs/getting-started/components/index.mdx +9 -0
  84. package/src/dist/contents/docs/getting-started/components/keyboard/index.mdx +117 -0
  85. package/src/dist/contents/docs/getting-started/components/link/index.mdx +34 -0
  86. package/src/dist/contents/docs/getting-started/components/note/index.mdx +46 -0
  87. package/src/dist/contents/docs/getting-started/components/release-note/index.mdx +130 -0
  88. package/src/dist/contents/docs/getting-started/components/stepper/index.mdx +47 -0
  89. package/src/dist/contents/docs/getting-started/components/tabs/index.mdx +70 -0
  90. package/src/dist/contents/docs/getting-started/components/tooltips/index.mdx +22 -0
  91. package/src/dist/contents/docs/getting-started/components/youtube/index.mdx +21 -0
  92. package/src/dist/contents/docs/getting-started/customize/index.mdx +94 -0
  93. package/src/dist/contents/docs/getting-started/installation/index.mdx +84 -0
  94. package/src/dist/contents/docs/getting-started/introduction/index.mdx +50 -0
  95. package/src/dist/contents/docs/getting-started/project-structure/index.mdx +87 -0
  96. package/src/dist/contents/docs/getting-started/quick-start-guide/index.mdx +127 -0
  97. package/src/dist/docu.json +100 -0
  98. package/src/dist/hooks/index.ts +2 -0
  99. package/src/dist/hooks/useActiveSection.ts +68 -0
  100. package/src/dist/hooks/useScrollPosition.ts +28 -0
  101. package/src/dist/lib/markdown.ts +244 -0
  102. package/src/dist/lib/routes-config.ts +28 -0
  103. package/src/dist/lib/toc.ts +9 -0
  104. package/src/dist/lib/utils.ts +80 -0
  105. package/src/dist/next-env.d.ts +5 -0
  106. package/src/dist/next.config.mjs +14 -0
  107. package/src/dist/package.json +58 -0
  108. package/src/dist/postcss.config.js +6 -0
  109. package/src/dist/public/favicon.ico +0 -0
  110. package/src/dist/public/images/docu.svg +6 -0
  111. package/src/dist/public/images/example-img.png +0 -0
  112. package/src/dist/public/images/img-playground.png +0 -0
  113. package/src/dist/public/images/new-editor.png +0 -0
  114. package/src/dist/public/images/og-image.png +0 -0
  115. package/src/dist/public/images/release-note.png +0 -0
  116. package/src/dist/public/images/snippet.png +0 -0
  117. package/src/dist/public/images/vercel.png +0 -0
  118. package/src/dist/public/images/view-changelog.png +0 -0
  119. package/src/dist/styles/editor.css +57 -0
  120. package/src/dist/styles/globals.css +156 -0
  121. package/src/dist/styles/syntax.css +100 -0
  122. package/src/dist/tailwind.config.ts +112 -0
  123. package/src/dist/tsconfig.json +26 -0
  124. package/src/index.js +19 -0
  125. package/src/installer/projectInstaller.js +125 -0
  126. package/src/utils/display.js +83 -0
  127. package/src/utils/logger.js +11 -0
  128. package/src/utils/packageManager.js +54 -0
  129. package/create.js +0 -211
package/README.md CHANGED
@@ -2,10 +2,8 @@
2
2
 
3
3
  **DocuBook** is a documentation web project designed to provide a simple and user-friendly interface for accessing various types of documentation. This site is crafted for developers and teams who need quick access to references, guides, and essential documents.
4
4
 
5
- > **Note**: This application is a fork of [AriaDocs](https://github.com/nisabmohd/Aria-Docs), created by [Nisab Mohd](https://github.com/nisabmohd). DocuBook provides an alternative to the documentation solution found on [Mintlify](https://mintlify.com/), utilizing `.mdx` (Markdown + JSX) for content creation and management.
6
-
7
5
  [![Deploy with
8
- Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/gitfromwildan/docubook)
6
+ Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/DocuBook/docubook)
9
7
 
10
8
  ## Features
11
9
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@docubook/create",
3
- "version": "1.9.1",
4
- "main": "index.js",
3
+ "version": "1.11.3",
4
+ "main": "src/index.js",
5
5
  "type": "module",
6
6
  "bin": {
7
- "create": "./create.js"
7
+ "create": "./src/index.js"
8
8
  },
9
9
  "keywords": [
10
10
  "template",
@@ -19,11 +19,8 @@
19
19
  "chalk": "^5.3.0",
20
20
  "cli-progress": "^3.12.0",
21
21
  "commander": "^12.1.0",
22
- "degit": "^2.8.4",
23
22
  "enquirer": "^2.4.1",
24
23
  "figlet": "^1.8.0",
25
- "ora": "^8.1.0",
26
- "prompts": "^2.4.2"
27
- },
28
- "packageManager": "pnpm@10.10.0"
24
+ "ora": "^8.1.0"
25
+ }
29
26
  }
@@ -0,0 +1,32 @@
1
+ import { program } from "commander";
2
+ import chalk from "chalk";
3
+ import { displayAsciiArt } from "../utils/display.js";
4
+ import { collectUserInput } from "./promptHandler.js";
5
+ import { createProject } from "../installer/projectInstaller.js";
6
+
7
+ /**
8
+ * Initializes the CLI program
9
+ * @param {string} version - Package version
10
+ */
11
+ export function initializeProgram(version) {
12
+ program
13
+ .version(version)
14
+ .description("CLI to create a new Docubook project")
15
+ .action(async () => {
16
+ try {
17
+ await displayAsciiArt();
18
+ console.log(chalk.white("DocuBook Installer\n"));
19
+
20
+ // Collect user input
21
+ const options = await collectUserInput();
22
+
23
+ // Create project with collected options
24
+ await createProject(options);
25
+ } catch (err) {
26
+ // Error handling is done in the respective modules
27
+ process.exit(1);
28
+ }
29
+ });
30
+
31
+ return program;
32
+ }
@@ -0,0 +1,73 @@
1
+ import enquirer from "enquirer";
2
+ import { detectDefaultPackageManager, getPackageManagerVersion } from "../utils/packageManager.js";
3
+ import log from "../utils/logger.js";
4
+
5
+ const { prompt } = enquirer;
6
+
7
+ /**
8
+ * Detects if the command was run with yarn or yarn dlx
9
+ * @returns {boolean}
10
+ */
11
+ function isYarnCommand() {
12
+ const userAgent = process.env.npm_config_user_agent || '';
13
+ return userAgent.includes('yarn') || process.argv.some(arg => arg.includes('yarn'));
14
+ }
15
+
16
+ /**
17
+ * Collects user input for project creation
18
+ * @returns {Promise<Object>} User answers
19
+ */
20
+ export async function collectUserInput() {
21
+ // Skip installation prompt if running with yarn/yarn dlx
22
+ const isYarn = isYarnCommand();
23
+ const defaultPackageManager = detectDefaultPackageManager();
24
+
25
+ // Get initial answers (directory name and package manager)
26
+ const { directoryName, packageManager } = await prompt([
27
+ {
28
+ type: "input",
29
+ name: "directoryName",
30
+ message: "📁 Project name",
31
+ initial: "docubook",
32
+ },
33
+ {
34
+ type: "select",
35
+ name: "packageManager",
36
+ message: "📦 Package manager",
37
+ choices: ["npm", "pnpm", "yarn", "bun"],
38
+ initial: defaultPackageManager,
39
+ }
40
+ ]);
41
+
42
+ // Only ask about installation if not using yarn
43
+ let installNow = false;
44
+ if (packageManager !== 'yarn') {
45
+ const { shouldInstall } = await prompt({
46
+ type: "confirm",
47
+ name: "shouldInstall",
48
+ message: "🛠️ Install dependencies now?",
49
+ initial: true,
50
+ });
51
+ installNow = shouldInstall;
52
+ }
53
+
54
+ // Prepare the answers object
55
+ const answers = {
56
+ directoryName,
57
+ packageManager,
58
+ installNow
59
+ };
60
+
61
+ // Validate package manager is installed
62
+ const version = getPackageManagerVersion(packageManager);
63
+
64
+ if (!version) {
65
+ log.error(`${packageManager} is not installed on your system.`);
66
+ process.exit(1);
67
+ }
68
+
69
+ return {
70
+ ...answers,
71
+ version
72
+ };
73
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Wildan Nursahidan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,37 @@
1
+ # DocuBook
2
+
3
+ **DocuBook** is a documentation web project designed to provide a simple and user-friendly interface for accessing various types of documentation. This site is crafted for developers and teams who need quick access to references, guides, and essential documents.
4
+
5
+ [![Deploy with
6
+ Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/DocuBook/docubook)
7
+
8
+ ## Features
9
+
10
+ - **Easy Navigation**: Simple layout for quick navigation between pages.
11
+ - **Quick Search**: Easily find documentation using a search function.
12
+ - **Responsive Theme**: Responsive design optimized for devices ranging from desktops to mobile.
13
+ - **Markdown Content**: Support for markdown-based documents.
14
+ - **SEO Friendly**: Optimized structure for search visibility, enhancing accessibility on search engines.
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npx @docubook/create@latest
20
+ ```
21
+
22
+ #### command output
23
+
24
+ ```bash
25
+ ? Enter a name for your project directory: (docubook)
26
+
27
+ Creating a new Docubook project in /path/your/docubook from the main branch...
28
+ ✔ Docubook project successfully created in /path/your/docubook!
29
+
30
+ Next steps:
31
+ 1. Navigate to your project directory:
32
+ cd docubook
33
+ 2. Install dependencies:
34
+ npm install
35
+ 3. Start the development server:
36
+ npm run dev
37
+ ```
@@ -0,0 +1,105 @@
1
+ import { notFound } from "next/navigation";
2
+ import { getDocsForSlug, getDocsTocs } from "@/lib/markdown";
3
+ import DocsBreadcrumb from "@/components/docs-breadcrumb";
4
+ import Pagination from "@/components/pagination";
5
+ import Toc from "@/components/toc";
6
+ import { Typography } from "@/components/typography";
7
+ import EditThisPage from "@/components/edit-on-github";
8
+ import { formatDate2 } from "@/lib/utils";
9
+ import docuConfig from "@/docu.json";
10
+ import MobToc from "@/components/mob-toc";
11
+
12
+ const { meta } = docuConfig;
13
+
14
+ type PageProps = {
15
+ params: {
16
+ slug: string[];
17
+ };
18
+ };
19
+
20
+ // Function to generate metadata dynamically
21
+ export async function generateMetadata({ params: { slug = [] } }: PageProps) {
22
+ const pathName = slug.join("/");
23
+ const res = await getDocsForSlug(pathName);
24
+
25
+ if (!res) {
26
+ return {
27
+ title: "Page Not Found",
28
+ description: "The requested page was not found.",
29
+ };
30
+ }
31
+
32
+ const { title, description, image } = res.frontmatter;
33
+
34
+ // Absolute URL for og:image
35
+ const ogImage = image
36
+ ? `${meta.baseURL}/images/${image}`
37
+ : `${meta.baseURL}/images/og-image.png`;
38
+
39
+ return {
40
+ title: `${title}`,
41
+ description,
42
+ openGraph: {
43
+ title,
44
+ description,
45
+ url: `${meta.baseURL}/docs/${pathName}`,
46
+ type: "article",
47
+ images: [
48
+ {
49
+ url: ogImage,
50
+ width: 1200,
51
+ height: 630,
52
+ alt: title,
53
+ },
54
+ ],
55
+ },
56
+ twitter: {
57
+ card: "summary_large_image",
58
+ title,
59
+ description,
60
+ images: [ogImage],
61
+ },
62
+ };
63
+ }
64
+
65
+ export default async function DocsPage({ params: { slug = [] } }: PageProps) {
66
+ const pathName = slug.join("/");
67
+ const res = await getDocsForSlug(pathName);
68
+
69
+ if (!res) notFound();
70
+
71
+ const { title, description, image, date } = res.frontmatter;
72
+
73
+ // File path for edit link
74
+ const filePath = `contents/docs/${slug.join("/") || ""}/index.mdx`;
75
+
76
+ const tocs = await getDocsTocs(pathName);
77
+
78
+ return (
79
+ <div className="flex items-start gap-10">
80
+ <div className="flex-[4.5] pt-5">
81
+ <MobToc tocs={tocs} />
82
+ <DocsBreadcrumb paths={slug} />
83
+ <Typography>
84
+ <h1 className="text-3xl !-mt-0.5">{title}</h1>
85
+ <p className="-mt-4 text-muted-foreground text-[16.5px]">{description}</p>
86
+ <div>{res.content}</div>
87
+ <div
88
+ className={`my-8 flex items-center border-b-2 border-dashed border-x-muted-foreground ${
89
+ docuConfig.repository?.editLink ? "justify-between" : "justify-end"
90
+ }`}
91
+ >
92
+ {docuConfig.repository?.editLink && <EditThisPage filePath={filePath} />}
93
+ {date && (
94
+ <p className="text-[13px] text-muted-foreground">
95
+ Published on {formatDate2(date)}
96
+ </p>
97
+ )}
98
+ </div>
99
+ <Pagination pathname={pathName} />
100
+ </Typography>
101
+ </div>
102
+ <Toc path={pathName} />
103
+ </div>
104
+ );
105
+ }
@@ -0,0 +1,16 @@
1
+ import { Leftbar } from "@/components/leftbar";
2
+
3
+ export default function DocsLayout({
4
+ children,
5
+ }: Readonly<{
6
+ children: React.ReactNode;
7
+ }>) {
8
+ return (
9
+ <div className="flex items-start gap-8">
10
+ <Leftbar key="leftbar" />
11
+ <div className="flex-[5.25] px-1">
12
+ {children}
13
+ </div>
14
+ </div>
15
+ );
16
+ }
@@ -0,0 +1,44 @@
1
+ "use client"; // Error components must be Client Components
2
+
3
+ import { Button, buttonVariants } from "@/components/ui/button";
4
+ import Link from "next/link";
5
+ import { useEffect } from "react";
6
+
7
+ export default function Error({
8
+ error,
9
+ reset,
10
+ }: {
11
+ error: Error & { digest?: string };
12
+ reset: () => void;
13
+ }) {
14
+ useEffect(() => {
15
+ console.error(error);
16
+ }, [error]);
17
+
18
+ return (
19
+ <div className="min-h-[87vh] px-2 sm:py-28 py-36 flex flex-col gap-4 items-center">
20
+ <div className="text-center flex flex-col items-center justify-center w-fit gap-2">
21
+ <h2 className="text-7xl font-bold pr-1">Oops!</h2>
22
+ <p className="text-muted-foreground text-md font-medium">
23
+ Something went wrong {":`("}
24
+ </p>
25
+ <p>
26
+ We&apos;re sorry, but an error occurred while processing your request.
27
+ </p>
28
+ </div>
29
+ <div className="flex items-center gap-2">
30
+ <Button
31
+ onClick={
32
+ // Attempt to recover by trying to re-render the segment
33
+ () => reset()
34
+ }
35
+ >
36
+ Reload page
37
+ </Button>
38
+ <Link href="/" className={buttonVariants({})}>
39
+ Back to homepage
40
+ </Link>
41
+ </div>
42
+ </div>
43
+ );
44
+ }
@@ -0,0 +1,96 @@
1
+ import type { Metadata } from "next";
2
+ import { ThemeProvider } from "@/components/contexts/theme-provider";
3
+ import { Navbar } from "@/components/navbar";
4
+ import { GeistSans } from "geist/font/sans";
5
+ import { GeistMono } from "geist/font/mono";
6
+ import { Footer } from "@/components/footer";
7
+ import docuConfig from "@/docu.json";
8
+ import { Toaster } from "@/components/ui/sonner";
9
+ import "@/styles/globals.css";
10
+
11
+ const { meta } = docuConfig;
12
+
13
+ // Default Metadata
14
+ const defaultMetadata: Metadata = {
15
+ metadataBase: new URL(meta.baseURL),
16
+ description: meta.description,
17
+ title: meta.title,
18
+ icons: {
19
+ icon: meta.favicon,
20
+ },
21
+ openGraph: {
22
+ title: meta.title,
23
+ description: meta.description,
24
+ images: [
25
+ {
26
+ url: new URL("/images/og-image.png", meta.baseURL).toString(),
27
+ width: 1200,
28
+ height: 630,
29
+ alt: String(meta.title),
30
+ },
31
+ ],
32
+ locale: "en_US",
33
+ type: "website",
34
+ },
35
+ };
36
+
37
+ // Dynamic Metadata Getter
38
+ export function getMetadata({
39
+ title,
40
+ description,
41
+ image,
42
+ }: {
43
+ title?: string;
44
+ description?: string;
45
+ image?: string;
46
+ }): Metadata {
47
+ const ogImage = image ? new URL(`/images/${image}`, meta.baseURL).toString() : undefined;
48
+
49
+ return {
50
+ ...defaultMetadata,
51
+ title: title ? `${title}` : defaultMetadata.title,
52
+ description: description || defaultMetadata.description,
53
+ openGraph: {
54
+ ...defaultMetadata.openGraph,
55
+ title: title || defaultMetadata.openGraph?.title,
56
+ description: description || defaultMetadata.openGraph?.description,
57
+ images: ogImage ? [
58
+ {
59
+ url: ogImage,
60
+ width: 1200,
61
+ height: 630,
62
+ alt: String(title || defaultMetadata.openGraph?.title),
63
+ },
64
+ ] : defaultMetadata.openGraph?.images,
65
+ },
66
+ };
67
+ }
68
+
69
+ export default function RootLayout({
70
+ children,
71
+ }: Readonly<{
72
+ children: React.ReactNode;
73
+ }>) {
74
+ return (
75
+ <html lang="en" suppressHydrationWarning>
76
+ <body
77
+ className={`${GeistSans.variable} ${GeistMono.variable} font-regular antialiased`}
78
+ suppressHydrationWarning
79
+ >
80
+ <ThemeProvider
81
+ attribute="class"
82
+ defaultTheme="system"
83
+ enableSystem
84
+ disableTransitionOnChange
85
+ >
86
+ <Navbar />
87
+ <main className="sm:container mx-auto w-[90vw] h-auto scroll-smooth">
88
+ {children}
89
+ </main>
90
+ <Footer />
91
+ <Toaster position="top-center" />
92
+ </ThemeProvider>
93
+ </body>
94
+ </html>
95
+ );
96
+ }
@@ -0,0 +1,19 @@
1
+ import { buttonVariants } from "@/components/ui/button";
2
+ import Link from "next/link";
3
+
4
+ export default function NotFound() {
5
+ return (
6
+ <div className="min-h-[87vh] px-2 sm:py-28 py-36 flex flex-col gap-4 items-center">
7
+ <div className="text-center flex flex-col items-center justify-center w-fit gap-2">
8
+ <h2 className="text-7xl font-bold pr-1">404</h2>
9
+ <p className="text-muted-foreground text-md font-medium">
10
+ Page not found {":("}
11
+ </p>
12
+ <p>Oops! The page you&apos;re looking for doesn&apos;t exist.</p>
13
+ </div>
14
+ <Link href="/" className={buttonVariants({})}>
15
+ Back to homepage
16
+ </Link>
17
+ </div>
18
+ );
19
+ }
@@ -0,0 +1,96 @@
1
+ import { buttonVariants } from "@/components/ui/button";
2
+ import { page_routes } from "@/lib/routes-config";
3
+ import { ArrowRightIcon, FileJson, GitCommitHorizontal, SquarePlay } from "lucide-react";
4
+ import Link from "next/link";
5
+ import { cn } from "@/lib/utils";
6
+ import AnimatedShinyText from "@/components/ui/animated-shiny-text";
7
+ import { getMetadata } from "@/app/layout";
8
+ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
9
+
10
+ export const metadata = getMetadata({
11
+ title: "Home",
12
+ });
13
+
14
+ export default function Home() {
15
+ return (
16
+ <div className="flex flex-col items-center justify-center px-2 py-8 text-center sm:py-36">
17
+ <Link
18
+ href="/docs/getting-started/changelog"
19
+ className="mb-5 sm:text-lg flex items-center gap-2 underline underline-offset-4 sm:-mt-12"
20
+ >
21
+ <div className="z-10 flex min-h-10 items-center justify-center max-[800px]:mt-10">
22
+ <div
23
+ className={cn(
24
+ "group rounded-full border border-black/5 bg-black/5 text-base text-white transition-all ease-in hover:cursor-pointer hover:bg-accent dark:border-white/5 dark:bg-transparent dark:hover:bg-accent",
25
+ )}
26
+ >
27
+ <AnimatedShinyText className="inline-flex items-center justify-center px-4 py-1 transition ease-out hover:text-neutral-100 hover:duration-300 hover:dark:text-neutral-200">
28
+ <span>🚀 New Version - Release v1.11.0</span>
29
+ <ArrowRightIcon className="ml-1 size-3 transition-transform duration-300 ease-in-out group-hover:translate-x-0.5" />
30
+ </AnimatedShinyText>
31
+ </div>
32
+ </div>
33
+ </Link>
34
+ <div className="w-full max-w-[800px] pb-8">
35
+ <h1 className="mb-4 text-2xl font-bold sm:text-5xl">DocuBook Starter Templates</h1>
36
+ <p className="mb-8 sm:text-xl text-muted-foreground">
37
+ Get started by editing app/page.tsx . Save and see your changes instantly.{' '}
38
+ <Link className="text-primary underline" href="https://www.docubook.pro/docs/getting-started/introduction" target="_blank">
39
+ Read Documentations
40
+ </Link>
41
+ </p>
42
+ </div>
43
+ <div className="flex flex-row items-center gap-6 mb-10">
44
+ <Link
45
+ href={`/docs${page_routes[0].href}`}
46
+ className={buttonVariants({
47
+ className: "px-6 bg-accent text-white hover:bg-primary dark:bg-accent dark:hover:bg-primary",
48
+ size: "lg",
49
+ })}
50
+ >
51
+ Get Started
52
+ </Link>
53
+ <Link
54
+ href="https://www.youtube.com/channel/UCWRCKHQCS-LCjd2WfDJCvRg?sub_confirmation=1"
55
+ target="_blank"
56
+ className={buttonVariants({
57
+ variant: "secondary",
58
+ className: "px-6 bg-gray-200 text-gray-900 hover:bg-gray-300 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",
59
+ size: "lg",
60
+ })}
61
+ >
62
+ Subscribe Now
63
+ </Link>
64
+ </div>
65
+ <div className="grid grid-cols-1 md:grid-cols-3 gap-8 py-12">
66
+ <Card className="px-2 py-6">
67
+ <CardHeader className="flex flex-row justify-center items-center gap-3">
68
+ <FileJson className="size-6 text-primary" />
69
+ <CardTitle className="text-xl">docu.json</CardTitle>
70
+ </CardHeader>
71
+ <CardContent>
72
+ <p>Edit the docu.json file to change the content in the header, footer and sidebar.</p>
73
+ </CardContent>
74
+ </Card>
75
+ <Card className="px-2 py-6">
76
+ <CardHeader className="flex flex-row justify-center items-center gap-3">
77
+ <GitCommitHorizontal className="size-6 text-primary" />
78
+ <CardTitle className="text-xl">CHANGELOG.md</CardTitle>
79
+ </CardHeader>
80
+ <CardContent>
81
+ <p>Manage changes to each version of your application in the CHANGELOG.md file.</p>
82
+ </CardContent>
83
+ </Card>
84
+ <Card className="px-2 py-6">
85
+ <CardHeader className="flex flex-row justify-center items-center gap-3">
86
+ <SquarePlay className="size-6 text-primary" />
87
+ <CardTitle className="text-xl">Docu Play</CardTitle>
88
+ </CardHeader>
89
+ <CardContent>
90
+ <p>Easy to write interactive markdown content with a playground.</p>
91
+ </CardContent>
92
+ </Card>
93
+ </div>
94
+ </div>
95
+ );
96
+ }
@@ -0,0 +1,44 @@
1
+ 'use client';
2
+
3
+ import React, { useEffect, useState } from 'react';
4
+ import Link from 'next/link';
5
+
6
+ const GitHubStarButton: React.FC = () => {
7
+ const [stars, setStars] = useState<number | null>(null);
8
+
9
+ useEffect(() => {
10
+ fetch('https://api.github.com/repos/gitfromwildan/docubook')
11
+ .then((res) => res.json())
12
+ .then((data) => {
13
+ if (data.stargazers_count !== undefined) {
14
+ setStars(data.stargazers_count);
15
+ }
16
+ })
17
+ .catch((error) => console.error('Failed to fetch stars:', error));
18
+ }, []);
19
+
20
+ const formatStars = (count: number) =>
21
+ count >= 1000 ? `${(count / 1000).toFixed(1)}K` : `${count}`;
22
+
23
+ return (
24
+ <Link
25
+ href="https://github.com/gitfromwildan/docubook"
26
+ target="_blank"
27
+ rel="noopener noreferrer"
28
+ className="inline-flex items-center rounded-full px-3 py-1.5 text-sm font-medium text-muted-foreground border no-underline"
29
+ >
30
+ <svg
31
+ height="16"
32
+ width="16"
33
+ viewBox="0 0 16 16"
34
+ aria-hidden="true"
35
+ className="fill-current mr-1.5"
36
+ >
37
+ <path d="M8 0C3.58 0 0 3.58 0 8a8 8 0 005.47 7.59c.4.07.55-.17.55-.38v-1.32c-2.22.48-2.69-1.07-2.69-1.07-.36-.92-.89-1.17-.89-1.17-.73-.5.06-.49.06-.49.81.06 1.23.83 1.23.83.72 1.23 1.89.88 2.35.67.07-.52.28-.88.5-1.08-1.77-.2-3.64-.88-3.64-3.93 0-.87.31-1.58.82-2.14-.08-.2-.36-1.01.08-2.12 0 0 .67-.21 2.2.82a7.7 7.7 0 012.01-.27 7.7 7.7 0 012.01.27c1.53-1.03 2.2-.82 2.2-.82.44 1.11.16 1.92.08 2.12.51.56.82 1.27.82 2.14 0 3.06-1.87 3.73-3.65 3.93.29.25.54.73.54 1.48v2.2c0 .21.15.46.55.38A8 8 0 0016 8c0-4.42-3.58-8-8-8z" />
38
+ </svg>
39
+ {stars !== null ? formatStars(stars) : '...'}
40
+ </Link>
41
+ );
42
+ };
43
+
44
+ export default GitHubStarButton;