From 99fd7710ce860fc8abc5215584e1b2de0827a547 Mon Sep 17 00:00:00 2001 From: sw-yx Date: Wed, 10 Apr 2019 11:16:26 -0400 Subject: [PATCH] fix npm run bug with execa --- src/commands/dev/index.js | 6 ++++-- src/detectors/utils/jsdetect.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/commands/dev/index.js b/src/commands/dev/index.js index cd505a8..45bfdae 100644 --- a/src/commands/dev/index.js +++ b/src/commands/dev/index.js @@ -156,7 +156,9 @@ function startDevServer(settings, log, error) { return; } log(`${NETLIFYDEVLOG} Starting Netlify Dev with ${settings.type}`); - const ps = execa(settings.command, settings.args, { + const args = + settings.command === "npm" ? ["run", ...settings.args] : settings.args; + const ps = execa(settings.command, args, { env: settings.env, stdio: "inherit" }); @@ -167,7 +169,7 @@ function startDevServer(settings, log, error) { class DevCommand extends Command { async run() { - this.log(`${NETLIFYDEV} Starting...`); + this.log(`${NETLIFYDEV}`); let { flags } = this.parse(DevCommand); const { api, site, config } = this.netlify; const functionsDir = diff --git a/src/detectors/utils/jsdetect.js b/src/detectors/utils/jsdetect.js index c7383cc..74fe543 100644 --- a/src/detectors/utils/jsdetect.js +++ b/src/detectors/utils/jsdetect.js @@ -25,7 +25,7 @@ function getYarnOrNPMCommand() { if (!yarnExists) { yarnExists = existsSync("yarn.lock") ? "yes" : "no"; } - return yarnExists === "yes" ? "yarn" : "npm run"; + return yarnExists === "yes" ? "yarn" : "npm"; } /**