File tree 1 file changed +9
-3
lines changed
packages/react-scripts/bin
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 11
11
'use strict' ;
12
12
13
13
const spawn = require ( 'react-dev-utils/crossSpawn' ) ;
14
- const script = process . argv [ 2 ] ;
15
- const args = process . argv . slice ( 3 ) ;
14
+ const args = process . argv . slice ( 2 ) ;
15
+
16
+ const scriptIndex = args . findIndex ( x =>
17
+ x === 'build' || x === 'eject' || x === 'start' || x === 'test' ) ;
18
+ const script = scriptIndex === - 1 ? args [ 0 ] : args [ scriptIndex ] ;
19
+ const nodeArgs = scriptIndex > 0 ? args . slice ( 0 , scriptIndex ) : [ ] ;
16
20
17
21
switch ( script ) {
18
22
case 'build' :
@@ -21,7 +25,9 @@ switch (script) {
21
25
case 'test' : {
22
26
const result = spawn . sync (
23
27
'node' ,
24
- [ require . resolve ( `../scripts/${ script } ` ) ] . concat ( args ) ,
28
+ nodeArgs
29
+ . concat ( require . resolve ( '../scripts/' + script ) )
30
+ . concat ( args . slice ( scriptIndex + 1 ) ) ,
25
31
{ stdio : 'inherit' }
26
32
) ;
27
33
if ( result . signal ) {
You can’t perform that action at this time.
0 commit comments