@docubook/create 1.8.6 → 1.8.7

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 (2) hide show
  1. package/create.js +17 -6
  2. package/package.json +1 -1
package/create.js CHANGED
@@ -102,9 +102,18 @@ function manualSteps(projectDirectory, packageManager) {
102
102
  );
103
103
  }
104
104
 
105
+ // Deteksi default package manager dari eksekusi CLI
106
+ function detectDefaultPackageManager() {
107
+ const userAgent = process.env.npm_config_user_agent || "";
108
+ if (userAgent.includes("pnpm")) return "pnpm";
109
+ if (userAgent.includes("yarn")) return "yarn";
110
+ if (userAgent.includes("bun")) return "bun";
111
+ return "npm";
112
+ }
113
+
105
114
  // ========== Entry CLI ========== //
106
115
  program
107
- .version("1.8.6")
116
+ .version("1.8.7")
108
117
  .description("CLI to create a new Docubook project")
109
118
  .argument("[project-directory]", "Directory to create the new Docubook project")
110
119
  .action(async (projectDirectory) => {
@@ -125,14 +134,15 @@ program
125
134
  }
126
135
 
127
136
  // Pilihan package manager
137
+ const defaultPM = detectDefaultPackageManager();
128
138
  const { packageManager } = await inquirer.prompt([
129
- {
139
+ {
130
140
  type: "list",
131
141
  name: "packageManager",
132
142
  message: "Choose a package manager:",
133
143
  choices: ["npm", "pnpm", "yarn", "bun"],
134
- default: "npm",
135
- },
144
+ default: defaultPM,
145
+ },
136
146
  ]);
137
147
 
138
148
  const version = getPackageManagerVersion(packageManager);
@@ -202,10 +212,11 @@ program
202
212
  try {
203
213
  execSync(`${packageManager} install`, { cwd: projectPath, stdio: "ignore" });
204
214
  installSpinner.succeed("Dependencies installed.");
205
- } catch {
215
+ } catch {
206
216
  installSpinner.fail("Failed to install dependencies.");
217
+ manualSteps(projectDirectory, packageManager); // Jika gagal install otomatis
207
218
  process.exit(1);
208
- }
219
+ }
209
220
 
210
221
  await simulateInstallation();
211
222
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docubook/create",
3
- "version": "1.8.6",
3
+ "version": "1.8.7",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "bin": {