@docubook/create 1.9.0 → 1.9.1
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/create.js +11 -23
- package/package.json +4 -3
package/create.js
CHANGED
|
@@ -5,11 +5,12 @@ import path from "path";
|
|
|
5
5
|
import fs from "fs";
|
|
6
6
|
import ora from "ora";
|
|
7
7
|
import chalk from "chalk";
|
|
8
|
-
import inquirer from "inquirer";
|
|
9
8
|
import boxen from "boxen";
|
|
10
9
|
import figlet from "figlet";
|
|
11
10
|
import cliProgress from "cli-progress";
|
|
12
11
|
import { execSync } from "child_process";
|
|
12
|
+
import enquirer from "enquirer";
|
|
13
|
+
const { prompt } = enquirer;
|
|
13
14
|
|
|
14
15
|
// Logging helper with styles
|
|
15
16
|
const log = {
|
|
@@ -19,16 +20,6 @@ const log = {
|
|
|
19
20
|
error: (msg) => console.log(chalk.red("✖ " + msg)),
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
// Cek apakah package manager terinstal di sistem
|
|
23
|
-
function isInstalled(command) {
|
|
24
|
-
try {
|
|
25
|
-
execSync(`${command} --version`, { stdio: "ignore" });
|
|
26
|
-
return true;
|
|
27
|
-
} catch {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
23
|
// Ambil versi package manager
|
|
33
24
|
function getPackageManagerVersion(pm) {
|
|
34
25
|
try {
|
|
@@ -107,32 +98,32 @@ function detectDefaultPackageManager() {
|
|
|
107
98
|
|
|
108
99
|
// Entry point utama CLI
|
|
109
100
|
program
|
|
110
|
-
.version("1.9.
|
|
101
|
+
.version("1.9.1")
|
|
111
102
|
.description("CLI to create a new Docubook project")
|
|
112
103
|
.action(async () => {
|
|
113
104
|
await displayAsciiArt();
|
|
114
105
|
console.log(chalk.white("DocuBook Installer\n"));
|
|
115
106
|
|
|
116
|
-
//
|
|
117
|
-
const answers = await
|
|
107
|
+
// Menggunakan enquirer untuk pengalaman mirip `npm create`
|
|
108
|
+
const answers = await prompt([
|
|
118
109
|
{
|
|
119
110
|
type: "input",
|
|
120
111
|
name: "directoryName",
|
|
121
112
|
message: "📁 Project name",
|
|
122
|
-
|
|
113
|
+
initial: "docubook",
|
|
123
114
|
},
|
|
124
115
|
{
|
|
125
|
-
type: "
|
|
116
|
+
type: "select",
|
|
126
117
|
name: "packageManager",
|
|
127
118
|
message: "📦 Package manager",
|
|
128
119
|
choices: ["npm", "pnpm", "yarn", "bun"],
|
|
129
|
-
|
|
120
|
+
initial: detectDefaultPackageManager(),
|
|
130
121
|
},
|
|
131
122
|
{
|
|
132
123
|
type: "confirm",
|
|
133
124
|
name: "installNow",
|
|
134
125
|
message: "🛠️ Install dependencies now?",
|
|
135
|
-
|
|
126
|
+
initial: true,
|
|
136
127
|
},
|
|
137
128
|
]);
|
|
138
129
|
|
|
@@ -153,10 +144,8 @@ program
|
|
|
153
144
|
try {
|
|
154
145
|
execSync(cloneCommand);
|
|
155
146
|
|
|
156
|
-
// Rename config jika pakai bun
|
|
157
147
|
if (packageManager === "bun") updatePostcssConfig(projectPath);
|
|
158
148
|
|
|
159
|
-
// Update packageManager di package.json
|
|
160
149
|
const pkgPath = path.join(projectPath, "package.json");
|
|
161
150
|
let pkgVersion = "";
|
|
162
151
|
if (fs.existsSync(pkgPath)) {
|
|
@@ -167,7 +156,7 @@ program
|
|
|
167
156
|
}
|
|
168
157
|
|
|
169
158
|
spinner.succeed();
|
|
170
|
-
log.success(`DocuBook v${pkgVersion}
|
|
159
|
+
log.success(`DocuBook v${pkgVersion} using \"${packageManager}\"`);
|
|
171
160
|
|
|
172
161
|
if (!installNow) {
|
|
173
162
|
manualSteps(directoryName, packageManager);
|
|
@@ -178,7 +167,7 @@ program
|
|
|
178
167
|
console.log(chalk.yellow("This is a joke for you:"));
|
|
179
168
|
console.log(
|
|
180
169
|
chalk.white(
|
|
181
|
-
"
|
|
170
|
+
"You don't need to worry about this process not running, you just need the latest device for a faster installation process."
|
|
182
171
|
)
|
|
183
172
|
);
|
|
184
173
|
|
|
@@ -200,7 +189,6 @@ program
|
|
|
200
189
|
|
|
201
190
|
await simulateInstallation();
|
|
202
191
|
|
|
203
|
-
// Tampilkan langkah selanjutnya setelah setup selesai
|
|
204
192
|
console.log(
|
|
205
193
|
boxen(
|
|
206
194
|
`Next Steps:\n\n` +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docubook/create",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
"cli-progress": "^3.12.0",
|
|
21
21
|
"commander": "^12.1.0",
|
|
22
22
|
"degit": "^2.8.4",
|
|
23
|
+
"enquirer": "^2.4.1",
|
|
23
24
|
"figlet": "^1.8.0",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
25
|
+
"ora": "^8.1.0",
|
|
26
|
+
"prompts": "^2.4.2"
|
|
26
27
|
},
|
|
27
28
|
"packageManager": "pnpm@10.10.0"
|
|
28
29
|
}
|