@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.
- package/README.md +1 -3
- package/package.json +4 -5
- package/src/cli/program.js +32 -0
- package/src/cli/promptHandler.js +73 -0
- package/src/dist/LICENSE +21 -0
- package/src/dist/README.md +37 -0
- package/src/dist/app/docs/[[...slug]]/page.tsx +105 -0
- package/src/dist/app/docs/layout.tsx +16 -0
- package/src/dist/app/error.tsx +44 -0
- package/src/dist/app/layout.tsx +96 -0
- package/src/dist/app/not-found.tsx +19 -0
- package/src/dist/app/page.tsx +96 -0
- package/src/dist/components/GithubStart.tsx +44 -0
- package/src/dist/components/Sponsor.tsx +69 -0
- package/src/dist/components/anchor.tsx +84 -0
- package/src/dist/components/contexts/theme-provider.tsx +9 -0
- package/src/dist/components/docs-breadcrumb.tsx +47 -0
- package/src/dist/components/docs-menu.tsx +45 -0
- package/src/dist/components/edit-on-github.tsx +33 -0
- package/src/dist/components/footer.tsx +85 -0
- package/src/dist/components/leftbar.tsx +95 -0
- package/src/dist/components/markdown/AccordionMdx.tsx +47 -0
- package/src/dist/components/markdown/ButtonMdx.tsx +52 -0
- package/src/dist/components/markdown/CardGroupMdx.tsx +28 -0
- package/src/dist/components/markdown/CardMdx.tsx +41 -0
- package/src/dist/components/markdown/CopyMdx.tsx +33 -0
- package/src/dist/components/markdown/ImageMdx.tsx +25 -0
- package/src/dist/components/markdown/KeyboardMdx.tsx +102 -0
- package/src/dist/components/markdown/LinkMdx.tsx +14 -0
- package/src/dist/components/markdown/NoteMdx.tsx +52 -0
- package/src/dist/components/markdown/OutletMdx.tsx +29 -0
- package/src/dist/components/markdown/PreMdx.tsx +19 -0
- package/src/dist/components/markdown/ReleaseMdx.tsx +109 -0
- package/src/dist/components/markdown/StepperMdx.tsx +41 -0
- package/src/dist/components/markdown/TooltipsMdx.tsx +28 -0
- package/src/dist/components/markdown/YoutubeMdx.tsx +22 -0
- package/src/dist/components/markdown/mdx-provider.tsx +29 -0
- package/src/dist/components/mob-toc.tsx +128 -0
- package/src/dist/components/navbar.tsx +87 -0
- package/src/dist/components/pagination.tsx +49 -0
- package/src/dist/components/scroll-to-top.tsx +86 -0
- package/src/dist/components/search.tsx +214 -0
- package/src/dist/components/sublink.tsx +133 -0
- package/src/dist/components/theme-toggle.tsx +71 -0
- package/src/dist/components/toc-observer.tsx +264 -0
- package/src/dist/components/toc.tsx +27 -0
- package/src/dist/components/typography.tsx +9 -0
- package/src/dist/components/ui/accordion.tsx +58 -0
- package/src/dist/components/ui/animated-shiny-text.tsx +40 -0
- package/src/dist/components/ui/aurora.tsx +45 -0
- package/src/dist/components/ui/avatar.tsx +50 -0
- package/src/dist/components/ui/badge.tsx +37 -0
- package/src/dist/components/ui/breadcrumb.tsx +115 -0
- package/src/dist/components/ui/button.tsx +57 -0
- package/src/dist/components/ui/card.tsx +76 -0
- package/src/dist/components/ui/collapsible.tsx +11 -0
- package/src/dist/components/ui/command.tsx +153 -0
- package/src/dist/components/ui/dialog.tsx +124 -0
- package/src/dist/components/ui/dropdown-menu.tsx +200 -0
- package/src/dist/components/ui/icon-cloud.tsx +324 -0
- package/src/dist/components/ui/input.tsx +25 -0
- package/src/dist/components/ui/interactive-hover-button.tsx +35 -0
- package/src/dist/components/ui/popover.tsx +33 -0
- package/src/dist/components/ui/scroll-area.tsx +48 -0
- package/src/dist/components/ui/separator.tsx +30 -0
- package/src/dist/components/ui/sheet.tsx +140 -0
- package/src/dist/components/ui/shine-border.tsx +64 -0
- package/src/dist/components/ui/skeleton.tsx +15 -0
- package/src/dist/components/ui/sonner.tsx +31 -0
- package/src/dist/components/ui/table.tsx +117 -0
- package/src/dist/components/ui/tabs.tsx +55 -0
- package/src/dist/components/ui/toggle-group.tsx +61 -0
- package/src/dist/components/ui/toggle.tsx +46 -0
- package/src/dist/components.json +17 -0
- package/src/dist/contents/docs/getting-started/changelog/index.mdx +512 -0
- package/src/dist/contents/docs/getting-started/components/accordion/index.mdx +72 -0
- package/src/dist/contents/docs/getting-started/components/button/index.mdx +42 -0
- package/src/dist/contents/docs/getting-started/components/card/index.mdx +70 -0
- package/src/dist/contents/docs/getting-started/components/card-group/index.mdx +49 -0
- package/src/dist/contents/docs/getting-started/components/code-block/index.mdx +41 -0
- package/src/dist/contents/docs/getting-started/components/custom/index.mdx +38 -0
- package/src/dist/contents/docs/getting-started/components/image/index.mdx +37 -0
- package/src/dist/contents/docs/getting-started/components/index.mdx +9 -0
- package/src/dist/contents/docs/getting-started/components/keyboard/index.mdx +117 -0
- package/src/dist/contents/docs/getting-started/components/link/index.mdx +34 -0
- package/src/dist/contents/docs/getting-started/components/note/index.mdx +46 -0
- package/src/dist/contents/docs/getting-started/components/release-note/index.mdx +130 -0
- package/src/dist/contents/docs/getting-started/components/stepper/index.mdx +47 -0
- package/src/dist/contents/docs/getting-started/components/tabs/index.mdx +70 -0
- package/src/dist/contents/docs/getting-started/components/tooltips/index.mdx +22 -0
- package/src/dist/contents/docs/getting-started/components/youtube/index.mdx +21 -0
- package/src/dist/contents/docs/getting-started/customize/index.mdx +94 -0
- package/src/dist/contents/docs/getting-started/installation/index.mdx +84 -0
- package/src/dist/contents/docs/getting-started/introduction/index.mdx +50 -0
- package/src/dist/contents/docs/getting-started/project-structure/index.mdx +87 -0
- package/src/dist/contents/docs/getting-started/quick-start-guide/index.mdx +127 -0
- package/src/dist/docu.json +100 -0
- package/src/dist/hooks/index.ts +2 -0
- package/src/dist/hooks/useActiveSection.ts +68 -0
- package/src/dist/hooks/useScrollPosition.ts +28 -0
- package/src/dist/lib/markdown.ts +244 -0
- package/src/dist/lib/routes-config.ts +28 -0
- package/src/dist/lib/toc.ts +9 -0
- package/src/dist/lib/utils.ts +80 -0
- package/src/dist/next-env.d.ts +5 -0
- package/src/dist/next.config.mjs +14 -0
- package/src/dist/package.json +58 -0
- package/src/dist/postcss.config.js +6 -0
- package/src/dist/public/favicon.ico +0 -0
- package/src/dist/public/images/docu.svg +6 -0
- package/src/dist/public/images/example-img.png +0 -0
- package/src/dist/public/images/img-playground.png +0 -0
- package/src/dist/public/images/new-editor.png +0 -0
- package/src/dist/public/images/og-image.png +0 -0
- package/src/dist/public/images/release-note.png +0 -0
- package/src/dist/public/images/snippet.png +0 -0
- package/src/dist/public/images/vercel.png +0 -0
- package/src/dist/public/images/view-changelog.png +0 -0
- package/src/dist/styles/editor.css +57 -0
- package/src/dist/styles/globals.css +156 -0
- package/src/dist/styles/syntax.css +100 -0
- package/src/dist/tailwind.config.ts +112 -0
- package/src/dist/tsconfig.json +26 -0
- package/src/index.js +19 -0
- package/src/installer/projectInstaller.js +125 -0
- package/src/utils/display.js +83 -0
- package/src/utils/logger.js +11 -0
- package/src/utils/packageManager.js +54 -0
- 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);
|