1 | #!/usr/bin/env node
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | 'use strict';
|
12 |
|
13 | var spawn = require('cross-spawn');
|
14 | var script = process.argv[2];
|
15 | var args = process.argv.slice(3);
|
16 |
|
17 | switch (script) {
|
18 | case 'build':
|
19 | case 'eject':
|
20 | case 'start':
|
21 | case 'test':
|
22 | var result = spawn.sync(
|
23 | 'node',
|
24 | [require.resolve('../scripts/' + script)].concat(args),
|
25 | {stdio: 'inherit'}
|
26 | );
|
27 | if (result.signal) {
|
28 | if (result.signal === 'SIGKILL') {
|
29 | console.log(
|
30 | 'The build failed because the process exited too early. ' +
|
31 | 'This probably means the system ran out of memory or someone called ' +
|
32 | '`kill -9` on the process.'
|
33 | );
|
34 | } else if (result.signal === 'SIGTERM') {
|
35 | console.log(
|
36 | 'The build failed because the process exited too early. ' +
|
37 | 'Someone might have called `kill` or `killall`, or the system could ' +
|
38 | 'be shutting down.'
|
39 | );
|
40 | }
|
41 | process.exit(1);
|
42 | }
|
43 | process.exit(result.status);
|
44 | break;
|
45 | default:
|
46 | console.log('Unknown script "' + script + '".');
|
47 | console.log('Perhaps you need to update react-scripts?');
|
48 | console.log('See: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#updating-to-new-releases');
|
49 | break;
|
50 | }
|