]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
fix: more accurate package manager inferring
authorHaoqun Jiang <haoqunjiang@gmail.com>
Mon, 17 Jan 2022 06:24:16 +0000 (14:24 +0800)
committerHaoqun Jiang <haoqunjiang@gmail.com>
Mon, 17 Jan 2022 06:24:16 +0000 (14:24 +0800)
index.js

index e4eabbfc1e7f87fd864ccbe34bf4c227cded2861..8fbe8f10650f5562e88fb11c8d85a016518ec8f4 100755 (executable)
--- a/index.js
+++ b/index.js
@@ -337,9 +337,10 @@ async function init() {
   // Supported package managers: pnpm > yarn > npm
   // Note: until <https://github.com/pnpm/pnpm/issues/3505> is resolved,
   // it is not possible to tell if the command is called by `pnpm init`.
-  const packageManager = /pnpm/.test(process.env.npm_execpath)
+  const packageManagerBinary = path.basename(process.env.npm_execpath)
+  const packageManager = /pnpm/.test(packageManagerBinary)
     ? 'pnpm'
-    : /yarn/.test(process.env.npm_execpath)
+    : /yarn/.test(packageManagerBinary)
     ? 'yarn'
     : 'npm'