react-scripts.js 1.17 KB
Newer Older
Dan Abramov's avatar
Dan Abramov committed
1
2
3
4
5
6
7
8
#!/usr/bin/env node
var spawn = require('cross-spawn');
var script = process.argv[2];
var args = process.argv.slice(3);

switch (script) {
case 'build':
case 'eject':
Christoph Pojer's avatar
Christoph Pojer committed
9
10
case 'start':
case 'test':
11
  var result = spawn.sync(
Dan Abramov's avatar
Dan Abramov committed
12
    'node',
13
    [require.resolve('../scripts/' + script)].concat(args),
Dan Abramov's avatar
Dan Abramov committed
14
15
    {stdio: 'inherit'}
  );
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  if (result.signal) {
    if (result.signal == 'SIGKILL') {
      console.log(
        'The build failed because the process exited too early. ' +
        'This probably means the system ran out of memory or someone called ' +
        '`kill -9` on the process.'
      );
    } else if (result.signal == 'SIGTERM') {
      console.log(
        'The build failed because the process exited too early. ' +
        'Someone might have called `kill` or `killall`, or the system could ' +
        'be shutting down.'
      );
    }
    process.exit(1);
  }
32
  process.exit(result.status);
Dan Abramov's avatar
Dan Abramov committed
33
34
35
36
  break;
default:
  console.log('Unknown script "' + script + '".');
  console.log('Perhaps you need to update react-scripts?');
37
  console.log('See: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#updating-to-new-releases');
Dan Abramov's avatar
Dan Abramov committed
38
39
  break;
}