99 * of patent rights can be found in the PATENTS file in the same directory.
1010 */
1111
12- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13- // /!\ DO NOT MODIFY THIS FILE /!\
14- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13+ // /!\ DO NOT MODIFY THIS FILE /!\
14+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1515//
1616// create-react-app is installed globally on people's computers. This means
1717// that it is extremely difficult to have them upgrade the version and
2121// The only job of create-react-app is to init the repository and then
2222// forward all the commands to the local version of create-react-app.
2323//
24- // If you need to add a new command, please add it to local-cli/ .
24+ // If you need to add a new command, please add it to the scripts/ folder .
2525//
2626// The only reason to modify this file is to add more warnings and
27- // troubleshooting information for the `react init ` command.
27+ // troubleshooting information for the `create- react-app ` command.
2828//
2929// Do not make breaking changes! We absolutely don't want to have to
3030// tell people to update their global version of create-react-app.
3131//
32- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33- // /!\ DO NOT MODIFY THIS FILE /!\
34- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33+ // /!\ DO NOT MODIFY THIS FILE /!\
34+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3535
3636'use strict' ;
3737
@@ -40,18 +40,18 @@ var path = require('path');
4040var spawn = require ( 'child_process' ) . spawn ;
4141var chalk = require ( 'chalk' ) ;
4242var semver = require ( 'semver' ) ;
43+ var argv = require ( 'minimist' ) ( process . argv . slice ( 2 ) ) ;
44+
4345/**
44- * Used arguments :
45- * -v -- version - to print current version of create-react-app and create-react-app-scripts dependency
46+ * Arguments :
47+ * -- version - to print current version
4648 * --verbose - to print logs while init
47- * --scripts-version <alternative create-react-app-scripts package> - override default (https://registry.npmjs.org/create-react-app-scripts@latest),
48- * package to install, examples :
49- * - "0.22.0-rc1" - A new app will be created using a specific version of React CLI from npm repo
50- * - "https://registry.npmjs.org/create-react-app-scripts/-/create-react-app-scripts-0.20.0.tgz" - a .tgz archive from any npm repo
51- * - "/Users/home/create-react-app/create-react-app-scripts-0.22.0.tgz" - for package prepared with `npm pack`, useful for e2e tests
49+ * --scripts-version <alternative package>
50+ * Example of valid values :
51+ * - a specific npm version: "0.22.0-rc1"
52+ * - a .tgz archive from any npm repo: "https://registry.npmjs.org/create-react-app-scripts/-/create-react-app-scripts-0.20.0.tgz"
53+ * - a package prepared with `npm pack`: "/Users/home/vjeux/ create-react-app/create-react-app-scripts-0.22.0.tgz"
5254 */
53- var argv = require ( 'minimist' ) ( process . argv . slice ( 2 ) ) ;
54-
5555var commands = argv . _ ;
5656if ( commands . length === 0 ) {
5757 console . error (
@@ -60,8 +60,8 @@ if (commands.length === 0) {
6060 process . exit ( 1 ) ;
6161}
6262
63- if ( argv . v || argv . version ) {
64- console . log ( 'create-react-app: ' + require ( './package.json' ) . version ) ;
63+ if ( argv . version ) {
64+ console . log ( 'create-react-app version : ' + require ( './package.json' ) . version ) ;
6565 process . exit ( ) ;
6666}
6767
@@ -70,7 +70,7 @@ createApp(commands[0], argv.verbose, argv['scripts-version']);
7070function createApp ( name , verbose , version ) {
7171 if ( fs . existsSync ( name ) ) {
7272 console . log ( 'Directory `' + name + '` already exists. Aborting.' ) ;
73- process . exit ( ) ;
73+ process . exit ( 1 ) ;
7474 }
7575
7676 var root = path . resolve ( name ) ;
@@ -146,11 +146,12 @@ function checkNodeVersion() {
146146 if ( ! packageJson . engines || ! packageJson . engines . node ) {
147147 return ;
148148 }
149+
149150 if ( ! semver . satisfies ( process . version , packageJson . engines . node ) ) {
150151 console . error (
151152 chalk . red (
152- 'You are currently running Node %s but React CLI requires %s. ' +
153- 'Please use a supported version of Node.\n'
153+ 'You are currently running Node %s but create-react-app requires %s.' +
154+ ' Please use a supported version of Node.\n'
154155 ) ,
155156 process . version ,
156157 packageJson . engines . node
0 commit comments