create-message-kit 1.1.7-beta.23 → 1.1.7-beta.24
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +14 -19
- package/package.json +1 -1
package/index.js
CHANGED
@@ -5,6 +5,7 @@ import { fileURLToPath } from "node:url";
|
|
5
5
|
import { log, outro, text, select } from "@clack/prompts";
|
6
6
|
import { default as fs } from "fs-extra";
|
7
7
|
import { isCancel } from "@clack/prompts";
|
8
|
+
import { detect } from "detect-package-manager";
|
8
9
|
import pc from "picocolors";
|
9
10
|
|
10
11
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
@@ -201,27 +202,21 @@ yarn-error.log*
|
|
201
202
|
fs.writeFileSync(resolve(destDir, ".gitignore"), gitignoreContent.trim());
|
202
203
|
}
|
203
204
|
|
204
|
-
function detectPackageManager() {
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
if (userAgent.includes(manager)) {
|
214
|
-
// Extract version for yarn
|
215
|
-
if (manager === "yarn") {
|
216
|
-
const version =
|
217
|
-
userAgent.match(/yarn\/(\d+\.\d+\.\d+)/)?.[1] || "4.5.1";
|
218
|
-
return `${value}@${version}`;
|
219
|
-
}
|
220
|
-
return value;
|
221
|
-
}
|
205
|
+
async function detectPackageManager() {
|
206
|
+
try {
|
207
|
+
const pkgManager = await detect();
|
208
|
+
// Still maintain the Yarn 4 check if needed
|
209
|
+
if (
|
210
|
+
pkgManager === "yarn" &&
|
211
|
+
process.env.npm_config_user_agent?.includes("yarn/4")
|
212
|
+
) {
|
213
|
+
return "yarn@4";
|
222
214
|
}
|
215
|
+
return pkgManager;
|
216
|
+
} catch (error) {
|
217
|
+
// Fallback to npm if detection fails
|
218
|
+
return "npm";
|
223
219
|
}
|
224
|
-
return "npm";
|
225
220
|
}
|
226
221
|
|
227
222
|
function kebabcase(str) {
|