@docubook/create 1.5.1 → 1.6.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 +32 -21
- package/package.json +1 -1
package/create.js
CHANGED
|
@@ -43,7 +43,7 @@ function updatePostcssConfig(projectPath) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
program
|
|
46
|
-
.version("1.
|
|
46
|
+
.version("1.6.9")
|
|
47
47
|
.description("CLI to create a new Docubook project")
|
|
48
48
|
.argument("[project-directory]", "Directory to create the new Docubook project")
|
|
49
49
|
.action(async (projectDirectory) => {
|
|
@@ -58,7 +58,7 @@ program
|
|
|
58
58
|
]);
|
|
59
59
|
projectDirectory = directoryName;
|
|
60
60
|
}
|
|
61
|
-
//
|
|
61
|
+
// --- clone from github ---
|
|
62
62
|
// const repo = "github:mywildancloud/docubook#starter";
|
|
63
63
|
// const emitter = degit(repo);
|
|
64
64
|
// const projectPath = path.resolve(process.cwd(), projectDirectory);
|
|
@@ -67,15 +67,19 @@ program
|
|
|
67
67
|
// try {
|
|
68
68
|
// await emitter.clone(projectPath);
|
|
69
69
|
// spinner.succeed(`Docubook project successfully created in ${projectPath}!`);
|
|
70
|
+
// --- clone from github ---
|
|
70
71
|
|
|
72
|
+
// --- clone from gitlab ---
|
|
71
73
|
const repo = "https://gitlab.com/mywildancloud/docubook.git";
|
|
72
74
|
const branch = "starter";
|
|
75
|
+
const projectPath = path.resolve(process.cwd(), projectDirectory);
|
|
73
76
|
const cloneCommand = `git clone --branch ${branch} ${repo} ${projectPath}`;
|
|
74
77
|
|
|
75
78
|
const spinner = ora(`Cloning ${chalk.green(branch)} from GitLab...`).start();
|
|
76
79
|
try {
|
|
77
80
|
execSync(cloneCommand, { stdio: "inherit" });
|
|
78
81
|
spinner.succeed(`Docubook project successfully created in ${projectPath}!`);
|
|
82
|
+
// --- clone from gitlab ---
|
|
79
83
|
|
|
80
84
|
// Jalankan rename hanya jika Bun terdeteksi
|
|
81
85
|
if (checkBunInstalled()) {
|
|
@@ -84,24 +88,24 @@ program
|
|
|
84
88
|
console.log(chalk.yellow("Skipping postcss.config.js rename because Bun is not installed."));
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
91
|
+
// const { enter } = await inquirer.prompt([
|
|
92
|
+
// {
|
|
93
|
+
// type: "confirm",
|
|
94
|
+
// name: "enter",
|
|
95
|
+
// message: "Install dependencies in the current project directory?",
|
|
96
|
+
// default: true,
|
|
97
|
+
// },
|
|
98
|
+
// ]);
|
|
99
|
+
|
|
100
|
+
// if (enter) {
|
|
101
|
+
// if (checkBunInstalled()) {
|
|
102
|
+
// console.log(chalk.green("\nBun detected. Installing dependencies with Bun..."));
|
|
103
|
+
// execSync("bun install", { stdio: "inherit", cwd: projectPath });
|
|
104
|
+
// } else {
|
|
105
|
+
// console.log(chalk.green("\nInstalling dependencies with npm..."));
|
|
106
|
+
// execSync("npm install", { stdio: "inherit", cwd: projectPath });
|
|
107
|
+
// }
|
|
108
|
+
// }
|
|
105
109
|
|
|
106
110
|
const packageJsonPath = path.join(projectPath, "package.json");
|
|
107
111
|
if (fs.existsSync(packageJsonPath)) {
|
|
@@ -112,7 +116,14 @@ program
|
|
|
112
116
|
console.log(chalk.green("\nNext steps:"));
|
|
113
117
|
console.log(`1. Navigate to your project directory:`);
|
|
114
118
|
console.log(` ${chalk.green(`cd ${projectDirectory}`)}`);
|
|
115
|
-
console.log(`2.
|
|
119
|
+
console.log(`2. Install dependencies:`);
|
|
120
|
+
|
|
121
|
+
if (checkBunInstalled()) {
|
|
122
|
+
console.log(` ${chalk.green("bun install")}`);
|
|
123
|
+
} else {
|
|
124
|
+
console.log(` ${chalk.green("npm install")}`);
|
|
125
|
+
}
|
|
126
|
+
console.log(`3. Start the development server:`);
|
|
116
127
|
|
|
117
128
|
if (checkBunInstalled()) {
|
|
118
129
|
console.log(` ${chalk.green("bun run dev")}`);
|