From 16bba79a6aabe53d967f6261ce8c8f8abccaf61f Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Mon, 17 Jan 2022 14:24:16 +0800 Subject: [PATCH] fix: more accurate package manager inferring --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index e4eabbfc..8fbe8f10 100755 --- a/index.js +++ b/index.js @@ -337,9 +337,10 @@ async function init() { // Supported package managers: pnpm > yarn > npm // Note: until 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' -- 2.39.5