@docubook/create 1.9.1 → 1.11.2

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 +4 -5
  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/create.js DELETED
@@ -1,211 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { program } from "commander";
4
- import path from "path";
5
- import fs from "fs";
6
- import ora from "ora";
7
- import chalk from "chalk";
8
- import boxen from "boxen";
9
- import figlet from "figlet";
10
- import cliProgress from "cli-progress";
11
- import { execSync } from "child_process";
12
- import enquirer from "enquirer";
13
- const { prompt } = enquirer;
14
-
15
- // Logging helper with styles
16
- const log = {
17
- info: (msg) => console.log(chalk.cyan("ℹ️ " + msg)),
18
- success: (msg) => console.log(chalk.green("✔ " + msg)),
19
- warn: (msg) => console.log(chalk.yellow("⚠️ " + msg)),
20
- error: (msg) => console.log(chalk.red("✖ " + msg)),
21
- };
22
-
23
- // Ambil versi package manager
24
- function getPackageManagerVersion(pm) {
25
- try {
26
- return execSync(`${pm} --version`).toString().trim();
27
- } catch {
28
- return null;
29
- }
30
- }
31
-
32
- // Rename file postcss.config.js → .cjs jika menggunakan bun
33
- function updatePostcssConfig(projectPath) {
34
- const oldPath = path.join(projectPath, "postcss.config.js");
35
- const newPath = path.join(projectPath, "postcss.config.cjs");
36
- if (fs.existsSync(oldPath)) {
37
- fs.renameSync(oldPath, newPath);
38
- }
39
- }
40
-
41
- // Menampilkan ASCII art "DocuBook" saat CLI dijalankan
42
- function displayAsciiArt() {
43
- return new Promise((resolve, reject) => {
44
- figlet.text("DocuBook", { horizontalLayout: "full" }, (err, data) => {
45
- if (err) return reject(err);
46
- console.log(chalk.green(data));
47
- resolve();
48
- });
49
- });
50
- }
51
-
52
- // Menampilkan progress bar saat simulasi setup akhir
53
- async function simulateInstallation() {
54
- const bar = new cliProgress.SingleBar(
55
- {
56
- format: 'Finishing Setup |' + chalk.green('{bar}') + '| {percentage}% || {value}/{total}',
57
- barCompleteChar: '\u2588',
58
- barIncompleteChar: '\u2591',
59
- },
60
- cliProgress.Presets.shades_classic
61
- );
62
-
63
- bar.start(100, 0);
64
- for (let i = 0; i <= 100; i++) {
65
- await new Promise((r) => setTimeout(r, 50));
66
- bar.update(i);
67
- }
68
- bar.stop();
69
- }
70
-
71
- // Menampilkan langkah manual jika instalasi otomatis dibatalkan/gagal
72
- function manualSteps(projectDirectory, packageManager) {
73
- const manualInstructions = `
74
- Please follow these steps manually to finish setting up your project:
75
-
76
- 1. ${chalk.cyan(`cd ${projectDirectory}`)}
77
- 2. ${chalk.cyan(`${packageManager} install`)}
78
- 3. ${chalk.cyan(`${packageManager} run dev`)}
79
- `;
80
-
81
- console.log(
82
- boxen(manualInstructions, {
83
- padding: 0.5,
84
- borderStyle: "round",
85
- borderColor: "cyan",
86
- })
87
- );
88
- }
89
-
90
- // Mendeteksi default package manager dari environment user
91
- function detectDefaultPackageManager() {
92
- const userAgent = process.env.npm_config_user_agent || "";
93
- if (userAgent.includes("pnpm")) return "pnpm";
94
- if (userAgent.includes("yarn")) return "yarn";
95
- if (userAgent.includes("bun")) return "bun";
96
- return "npm";
97
- }
98
-
99
- // Entry point utama CLI
100
- program
101
- .version("1.9.1")
102
- .description("CLI to create a new Docubook project")
103
- .action(async () => {
104
- await displayAsciiArt();
105
- console.log(chalk.white("DocuBook Installer\n"));
106
-
107
- // Menggunakan enquirer untuk pengalaman mirip `npm create`
108
- const answers = await prompt([
109
- {
110
- type: "input",
111
- name: "directoryName",
112
- message: "📁 Project name",
113
- initial: "docubook",
114
- },
115
- {
116
- type: "select",
117
- name: "packageManager",
118
- message: "📦 Package manager",
119
- choices: ["npm", "pnpm", "yarn", "bun"],
120
- initial: detectDefaultPackageManager(),
121
- },
122
- {
123
- type: "confirm",
124
- name: "installNow",
125
- message: "🛠️ Install dependencies now?",
126
- initial: true,
127
- },
128
- ]);
129
-
130
- const { directoryName, packageManager, installNow } = answers;
131
- const projectPath = path.resolve(process.cwd(), directoryName);
132
- const version = getPackageManagerVersion(packageManager);
133
-
134
- if (!version) {
135
- log.error(`${packageManager} is not installed on your system.`);
136
- process.exit(1);
137
- }
138
-
139
- const repo = "https://gitlab.com/mywildancloud/docubook.git";
140
- const branch = "starter";
141
- const cloneCommand = `git clone --quiet --branch ${branch} ${repo} ${projectPath}`;
142
- const spinner = ora("Creating your DocuBook project...").start();
143
-
144
- try {
145
- execSync(cloneCommand);
146
-
147
- if (packageManager === "bun") updatePostcssConfig(projectPath);
148
-
149
- const pkgPath = path.join(projectPath, "package.json");
150
- let pkgVersion = "";
151
- if (fs.existsSync(pkgPath)) {
152
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
153
- pkg.packageManager = `${packageManager}@${version}`;
154
- pkgVersion = pkg.version || "";
155
- fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
156
- }
157
-
158
- spinner.succeed();
159
- log.success(`DocuBook v${pkgVersion} using \"${packageManager}\"`);
160
-
161
- if (!installNow) {
162
- manualSteps(directoryName, packageManager);
163
- return;
164
- }
165
-
166
- log.info("Installing dependencies...");
167
- console.log(chalk.yellow("This is a joke for you:"));
168
- console.log(
169
- chalk.white(
170
- "You don't need to worry about this process not running, you just need the latest device for a faster installation process."
171
- )
172
- );
173
-
174
- const installSpinner = ora(`Using ${packageManager}...`).start();
175
-
176
- if (packageManager === "yarn") {
177
- const yarnrcPath = path.join(projectPath, ".yarnrc.yml");
178
- fs.writeFileSync(yarnrcPath, "nodeLinker: node-modules\n");
179
- }
180
-
181
- try {
182
- execSync(`${packageManager} install`, { cwd: projectPath, stdio: "ignore" });
183
- installSpinner.succeed("Dependencies installed.");
184
- } catch {
185
- installSpinner.fail("Failed to install dependencies.");
186
- manualSteps(directoryName, packageManager);
187
- process.exit(1);
188
- }
189
-
190
- await simulateInstallation();
191
-
192
- console.log(
193
- boxen(
194
- `Next Steps:\n\n` +
195
- `1. ${chalk.cyan(`cd ${directoryName}`)}\n` +
196
- `2. ${chalk.cyan(`${packageManager} run dev`)}`,
197
- {
198
- padding: 0.5,
199
- borderStyle: "round",
200
- borderColor: "cyan",
201
- }
202
- )
203
- );
204
- } catch (err) {
205
- spinner.fail("Failed to create project.");
206
- log.error(err.message);
207
- process.exit(1);
208
- }
209
- });
210
-
211
- program.parse(process.argv);