From 61e84ea44dd5c54a6d8a4e1bc9598ed989dfee01 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Wed, 9 Nov 2022 11:22:27 -0700 Subject: [PATCH] When running through npx, use the npm that should be next to it. This should improve things hopefully. --- .github/workflows/release.yml | 4 ++++ lib/run-task.js | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c4dabd..d192987 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,10 @@ env: NODE_VERSION: 'lts/*' FORCE_COLOR: 2 +concurrency: # prevent concurrent releases + group: npm-bump + cancel-in-progress: true + jobs: version_and_release: runs-on: ubuntu-latest diff --git a/lib/run-task.js b/lib/run-task.js index 7c1b1e1..5e1f498 100644 --- a/lib/run-task.js +++ b/lib/run-task.js @@ -153,7 +153,9 @@ module.exports = function runTask(task, options) { } // Execute. - const npmPath = options.npmPath || process.env.NPM_CLI_JS || process.env.npm_execpath //eslint-disable-line no-process-env + const npmPath = options.npmPath || path.basename(process.env.npm_execpath).startsWith("npx") //eslint-disable-line no-process-env + ? path.join(path.dirname(process.env.npm_execpath), path.basename(process.env.npm_execpath).replace("npx", "npm")) //eslint-disable-line no-process-env + : process.env.npm_execpath //eslint-disable-line no-process-env const npmPathIsJs = typeof npmPath === "string" && /\.m?js/.test(path.extname(npmPath)) const execPath = (npmPathIsJs ? process.execPath : npmPath || "npm") const isYarn = process.env.npm_config_user_agent && process.env.npm_config_user_agent.startsWith("yarn") //eslint-disable-line no-process-env