@@ -24,42 +24,35 @@ const scriptIndex = args.findIndex(
24
24
const script = scriptIndex === - 1 ? args [ 0 ] : args [ scriptIndex ] ;
25
25
const nodeArgs = scriptIndex > 0 ? args . slice ( 0 , scriptIndex ) : [ ] ;
26
26
27
- switch ( script ) {
28
- case 'build' :
29
- case 'eject' :
30
- case 'start' :
31
- case 'test' : {
32
- const result = spawn . sync (
33
- 'node' ,
34
- nodeArgs
35
- . concat ( require . resolve ( '../scripts/' + script ) )
36
- . concat ( args . slice ( scriptIndex + 1 ) ) ,
37
- { stdio : 'inherit' }
38
- ) ;
39
- if ( result . signal ) {
40
- if ( result . signal === 'SIGKILL' ) {
41
- console . log (
42
- 'The build failed because the process exited too early. ' +
43
- 'This probably means the system ran out of memory or someone called ' +
44
- '`kill -9` on the process.'
45
- ) ;
46
- } else if ( result . signal === 'SIGTERM' ) {
47
- console . log (
48
- 'The build failed because the process exited too early. ' +
49
- 'Someone might have called `kill` or `killall`, or the system could ' +
50
- 'be shutting down.'
51
- ) ;
52
- }
53
- process . exit ( 1 ) ;
27
+ if ( [ 'build' , 'eject' , 'start' , 'test' ] . includes ( script ) ) {
28
+ const result = spawn . sync (
29
+ 'node' ,
30
+ nodeArgs
31
+ . concat ( require . resolve ( '../scripts/' + script ) )
32
+ . concat ( args . slice ( scriptIndex + 1 ) ) ,
33
+ { stdio : 'inherit' }
34
+ ) ;
35
+ if ( result . signal ) {
36
+ if ( result . signal === 'SIGKILL' ) {
37
+ console . log (
38
+ 'The build failed because the process exited too early. ' +
39
+ 'This probably means the system ran out of memory or someone called ' +
40
+ '`kill -9` on the process.'
41
+ ) ;
42
+ } else if ( result . signal === 'SIGTERM' ) {
43
+ console . log (
44
+ 'The build failed because the process exited too early. ' +
45
+ 'Someone might have called `kill` or `killall`, or the system could ' +
46
+ 'be shutting down.'
47
+ ) ;
54
48
}
55
- process . exit ( result . status ) ;
56
- break ;
49
+ process . exit ( 1 ) ;
57
50
}
58
- default :
59
- console . log ( 'Unknown script "' + script + '".' ) ;
60
- console . log ( 'Perhaps you need to update react-scripts? ' ) ;
61
- console . log (
62
- 'See: https://facebook.github.io/create-react-app/docs/updating-to-new-releases'
63
- ) ;
64
- break ;
51
+ process . exit ( result . status ) ;
52
+ } else {
53
+ console . log ( 'Unknown script "' + script + '". ') ;
54
+ console . log ( 'Perhaps you need to update react-scripts?' ) ;
55
+ console . log (
56
+ 'See: https://facebook.github.io/create-react-app/docs/updating-to-new-releases'
57
+ ) ;
65
58
}
0 commit comments