UNPKG

1.53 kBJavaScriptView Raw
1#!/usr/bin/env node
2/**
3 * Copyright (c) 2015-present, Facebook, Inc.
4 * All rights reserved.
5 *
6 * This source code is licensed under the BSD-style license found in the
7 * LICENSE file in the root directory of this source tree. An additional grant
8 * of patent rights can be found in the PATENTS file in the same directory.
9 */
10
11'use strict';
12
13var spawn = require('cross-spawn');
14var script = process.argv[2];
15var args = process.argv.slice(3);
16
17switch (script) {
18case 'build':
19case 'eject':
20case 'start':
21case '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;
45default:
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}