From 036f6e11161e6e10fca355881951d1a4e43a2b90 Mon Sep 17 00:00:00 2001 From: Konstantin Tarkus Date: Mon, 7 Aug 2017 07:33:53 +0300 Subject: [PATCH 1/4] Fix the order of arguments in spawned child proc --- packages/react-scripts/bin/react-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/bin/react-scripts.js b/packages/react-scripts/bin/react-scripts.js index abb2741f854..e964f9291eb 100755 --- a/packages/react-scripts/bin/react-scripts.js +++ b/packages/react-scripts/bin/react-scripts.js @@ -21,7 +21,7 @@ switch (script) { case 'test': { const result = spawn.sync( 'node', - [require.resolve(`../scripts/${script}`)].concat(args), + args.concat(require.resolve(`../scripts/${script}`)), { stdio: 'inherit' } ); if (result.signal) { From 6a57270de3bd04c6d413a750ccd62612bf27183d Mon Sep 17 00:00:00 2001 From: Konstantin Tarkus Date: Mon, 7 Aug 2017 09:40:05 +0300 Subject: [PATCH 2/4] Update react-scripts.js --- packages/react-scripts/bin/react-scripts.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/react-scripts/bin/react-scripts.js b/packages/react-scripts/bin/react-scripts.js index e964f9291eb..b205beae0d8 100755 --- a/packages/react-scripts/bin/react-scripts.js +++ b/packages/react-scripts/bin/react-scripts.js @@ -11,8 +11,13 @@ 'use strict'; const spawn = require('react-dev-utils/crossSpawn'); -const script = process.argv[2]; -const args = process.argv.slice(3); +const args = process.argv.slice(2); + +const scriptIndex = args.findIndex( + x => x === 'build' || x === 'eject' || x === 'start' || x === 'test', +); +const script = scriptIndex === -1 ? args[0] : args[scriptIndex]; +const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : []; switch (script) { case 'build': @@ -21,7 +26,9 @@ switch (script) { case 'test': { const result = spawn.sync( 'node', - args.concat(require.resolve(`../scripts/${script}`)), + nodeArgs + .concat(require.resolve('../scripts/' + script)) + .concat(args.slice(scriptIndex + 1)) { stdio: 'inherit' } ); if (result.signal) { From 779f0388952a42f75ebf480b0c9eb581094bfdd3 Mon Sep 17 00:00:00 2001 From: Konstantin Tarkus Date: Mon, 7 Aug 2017 09:46:55 +0300 Subject: [PATCH 3/4] Remove a comma --- packages/react-scripts/bin/react-scripts.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/react-scripts/bin/react-scripts.js b/packages/react-scripts/bin/react-scripts.js index b205beae0d8..13e91f6fe09 100755 --- a/packages/react-scripts/bin/react-scripts.js +++ b/packages/react-scripts/bin/react-scripts.js @@ -13,9 +13,8 @@ const spawn = require('react-dev-utils/crossSpawn'); const args = process.argv.slice(2); -const scriptIndex = args.findIndex( - x => x === 'build' || x === 'eject' || x === 'start' || x === 'test', -); +const scriptIndex = args.findIndex(x => + x === 'build' || x === 'eject' || x === 'start' || x === 'test'); const script = scriptIndex === -1 ? args[0] : args[scriptIndex]; const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : []; From 79720f54c7a003154272b646ceaa811f89de1390 Mon Sep 17 00:00:00 2001 From: Konstantin Tarkus Date: Mon, 7 Aug 2017 09:51:53 +0300 Subject: [PATCH 4/4] Update react-scripts.js --- packages/react-scripts/bin/react-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/bin/react-scripts.js b/packages/react-scripts/bin/react-scripts.js index 13e91f6fe09..1261de6be19 100755 --- a/packages/react-scripts/bin/react-scripts.js +++ b/packages/react-scripts/bin/react-scripts.js @@ -27,7 +27,7 @@ switch (script) { 'node', nodeArgs .concat(require.resolve('../scripts/' + script)) - .concat(args.slice(scriptIndex + 1)) + .concat(args.slice(scriptIndex + 1)), { stdio: 'inherit' } ); if (result.signal) {