From dc2d7da61cf0898d0bc2b25747e588325e06b9a9 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Fri, 13 Sep 2024 14:45:23 -0700 Subject: [PATCH] Avoid passing config fields as flags for pnpm Matching the behavior with yarn, stop npm-run-all2 from passing fields in the package.json#config field as flags. --- lib/run-task.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/run-task.js b/lib/run-task.js index f83be49..4a3b362 100644 --- a/lib/run-task.js +++ b/lib/run-task.js @@ -192,13 +192,15 @@ module.exports = function runTask (task, options) { } const isYarn = process.env.npm_config_user_agent && process.env.npm_config_user_agent.startsWith('yarn') + const isPnpm = Boolean(process.env.PNPM_SCRIPT_SRC_DIR) + const isNpm = !isYarn && !isPnpm const spawnArgs = ['run'] if (npmPathIsJs) { spawnArgs.unshift(npmPath) } - if (!isYarn) { + if (isNpm) { Array.prototype.push.apply(spawnArgs, options.prefixOptions) } else if (options.prefixOptions.indexOf('--silent') !== -1) { spawnArgs.push('--silent')