create-message-kit 1.1.7-beta.23 → 1.1.7-beta.24

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/index.js +14 -19
  2. 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
- const userAgent = process.env.npm_config_user_agent;
206
- if (!userAgent) return "npm";
207
- if (userAgent.includes("bun")) return "bun";
208
- if (userAgent.includes("pnpm")) return "pnpm";
209
- if (userAgent.includes("npm")) return "npm";
210
-
211
- if (userAgent.includes("yarn")) {
212
- for (const [manager, value] of Object.entries(managers)) {
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-message-kit",
3
- "version": "1.1.7-beta.23",
3
+ "version": "1.1.7-beta.24",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "index.js",