create-message-kit 1.1.7-beta.23 → 1.1.7-beta.25
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +15 -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));
|
@@ -20,6 +21,7 @@ program
|
|
20
21
|
.action(async () => {
|
21
22
|
// Add Yarn 4 check at the start of the action
|
22
23
|
const pkgManager = detectPackageManager();
|
24
|
+
console.log(pkgManager);
|
23
25
|
if (pkgManager.startsWith("yarn@4")) {
|
24
26
|
log.error("Yarn 4 is not supported. Please use bun, npm, or yarn v1");
|
25
27
|
process.exit(1);
|
@@ -201,27 +203,21 @@ yarn-error.log*
|
|
201
203
|
fs.writeFileSync(resolve(destDir, ".gitignore"), gitignoreContent.trim());
|
202
204
|
}
|
203
205
|
|
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
|
-
}
|
206
|
+
async function detectPackageManager() {
|
207
|
+
try {
|
208
|
+
const pkgManager = await detect();
|
209
|
+
// Still maintain the Yarn 4 check if needed
|
210
|
+
if (
|
211
|
+
pkgManager === "yarn" &&
|
212
|
+
process.env.npm_config_user_agent?.includes("yarn/4")
|
213
|
+
) {
|
214
|
+
return "yarn@4";
|
222
215
|
}
|
216
|
+
return pkgManager;
|
217
|
+
} catch (error) {
|
218
|
+
// Fallback to npm if detection fails
|
219
|
+
return "npm";
|
223
220
|
}
|
224
|
-
return "npm";
|
225
221
|
}
|
226
222
|
|
227
223
|
function kebabcase(str) {
|