@docubook/create 1.4.7 → 1.4.9
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 +22 -17
- package/package.json +1 -1
package/create.js
CHANGED
|
@@ -43,32 +43,37 @@ function updatePostcssConfig(projectPath) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
program
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
.version("1.4.9")
|
|
47
|
+
.description("CLI to create a new Docubook project")
|
|
48
|
+
.argument("[project-directory]", "Directory to create the new Docubook project")
|
|
49
|
+
.action(async (projectDirectory) => {
|
|
50
50
|
if (!projectDirectory) {
|
|
51
|
-
|
|
51
|
+
const { directoryName } = await inquirer.prompt([
|
|
52
52
|
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
type: "input",
|
|
54
|
+
name: "directoryName",
|
|
55
|
+
message: "Enter a name for your project directory:",
|
|
56
|
+
default: "docubook",
|
|
57
57
|
},
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
]);
|
|
59
|
+
projectDirectory = directoryName;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
const repo = "github:mywildancloud/docubook#starter";
|
|
63
63
|
const emitter = degit(repo);
|
|
64
64
|
const projectPath = path.resolve(process.cwd(), projectDirectory);
|
|
65
65
|
|
|
66
|
-
const spinner = ora(`Cloning ${chalk.
|
|
66
|
+
const spinner = ora(`Cloning ${chalk.green("starter")}...`).start();
|
|
67
67
|
try {
|
|
68
68
|
await emitter.clone(projectPath);
|
|
69
69
|
spinner.succeed(`Docubook project successfully created in ${projectPath}!`);
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
// Jalankan rename hanya jika Bun terdeteksi
|
|
72
|
+
if (checkBunInstalled()) {
|
|
73
|
+
updatePostcssConfig(projectPath);
|
|
74
|
+
} else {
|
|
75
|
+
console.log(chalk.yellow("Skipping postcss.config.js rename because Bun is not installed."));
|
|
76
|
+
}
|
|
72
77
|
|
|
73
78
|
const { enter } = await inquirer.prompt([
|
|
74
79
|
{
|
|
@@ -95,15 +100,15 @@ program
|
|
|
95
100
|
console.log(chalk.green(`\nDocubook version: ${packageJson.version}\n`));
|
|
96
101
|
}
|
|
97
102
|
|
|
98
|
-
console.log(chalk.
|
|
103
|
+
console.log(chalk.green("\nNext steps:"));
|
|
99
104
|
console.log(`1. Navigate to your project directory:`);
|
|
100
|
-
console.log(` ${chalk.
|
|
105
|
+
console.log(` ${chalk.green(`cd ${projectDirectory}`)}`);
|
|
101
106
|
console.log(`2. Start the development server:`);
|
|
102
107
|
|
|
103
108
|
if (checkBunInstalled()) {
|
|
104
|
-
console.log(` ${chalk.
|
|
109
|
+
console.log(` ${chalk.green("bun run dev")}`);
|
|
105
110
|
} else {
|
|
106
|
-
console.log(` ${chalk.
|
|
111
|
+
console.log(` ${chalk.green("npm run dev")}`);
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
process.exit(0);
|