Skip to content

Commit

Permalink
Bump minimal Node version to 6 (facebook#1897)
Browse files Browse the repository at this point in the history
* Bump minimal Node version to 4.7.0

* Bump minimal Node version to 4.7.0

Modified additional files that needed a bump to 4.7.0 minimum node version

* Bump minimal Node version to 4.7.0

Reverse changes to packages/create-react-app/index.js as this file needs to continue to work on Node 0.10+

* Bump minimal node version to 6

* Bump minimal node version to 6

* Bump minimal node version to 6
  • Loading branch information
ianschmitz authored and romaindso committed Jul 10, 2017
1 parent 16f402c commit e91ba24
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 30 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
language: node_js
node_js:
- 4
- 6
- 7
cache:
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ Install it once globally:
npm install -g create-react-app
```

**You’ll need to have Node >= 4 on your machine**.

**We strongly recommend to use Node >= 6 and npm >= 3 for faster installation speed and better disk usage.** You can use [nvm](https://github.com/creationix/nvm#usage) to easily switch Node versions between different projects.
**You’ll need to have Node >= 6 on your machine**. You can use [nvm](https://github.com/creationix/nvm#usage) to easily switch Node versions between different projects.

**This tool doesn’t assume a Node backend**. The Node installation is only required for Create React App itself.

Expand Down
6 changes: 0 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ environment:
test_suite: "installs"
- nodejs_version: 6
test_suite: "kitchensink"
- nodejs_version: 4
test_suite: "simple"
- nodejs_version: 4
test_suite: "installs"
- nodejs_version: 4
test_suite: "kitchensink"

cache:
- node_modules -> appveyor.cleanup-cache.txt
Expand Down
25 changes: 12 additions & 13 deletions packages/create-react-app/createReactApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// tell people to update their global version of create-react-app.
//
// Also be careful with new language features.
// This file must work on Node 4+.
// This file must work on Node 6+.
//
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// /!\ DO NOT MODIFY THIS FILE /!\
Expand Down Expand Up @@ -398,24 +398,23 @@ function getPackageName(installPackage) {
}

function checkNpmVersion() {
let isNpm2 = false;
let hasMinNpm = false;
try {
const npmVersion = execSync('npm --version').toString();
isNpm2 = semver.lt(npmVersion, '3.0.0');
hasMinNpm = semver.gte(npmVersion, '3.0.0');
} catch (err) {
return;
}
if (!isNpm2) {
return;

if (!hasMinNpm) {
console.error(
chalk.red(
'Create React App requires npm 3 or higher. \n' +
'Please update your version of npm.'
)
);
process.exit(1);
}
console.log(chalk.yellow('It looks like you are using npm 2.'));
console.log(
chalk.yellow(
'We suggest using npm 3 or Yarn for faster install times ' +
'and less disk space usage.'
)
);
console.log();
}

function checkNodeVersion(packageName) {
Expand Down
7 changes: 5 additions & 2 deletions packages/create-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@
var chalk = require('chalk');

var currentNodeVersion = process.versions.node;
if (currentNodeVersion.split('.')[0] < 4) {
var semver = currentNodeVersion.split('.');
var major = semver[0];

if (major < 6) {
console.error(
chalk.red(
'You are running Node ' +
currentNodeVersion +
'.\n' +
'Create React App requires Node 4 or higher. \n' +
'Create React App requires Node 6 or higher. \n' +
'Please update your version of Node.'
)
);
Expand Down
2 changes: 1 addition & 1 deletion packages/create-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"repository": "facebookincubator/create-react-app",
"license": "BSD-3-Clause",
"engines": {
"node": ">=4"
"node": ">=6"
},
"bugs": {
"url": "https://github.com/facebookincubator/create-react-app/issues"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"url": "https://github.com/facebookincubator/create-react-app/issues"
},
"engines": {
"node": ">=4"
"node": ">=6"
},
"files": [
"ansiHTML.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "facebookincubator/create-react-app",
"license": "BSD-3-Clause",
"engines": {
"node": ">=4"
"node": ">=6"
},
"bugs": {
"url": "https://github.com/facebookincubator/create-react-app/issues"
Expand Down
7 changes: 5 additions & 2 deletions tasks/e2e-simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ cd "$root_path"/packages/create-react-app
npm install
cd "$root_path"

# If the node version is < 4, the script should just give an error.
if [[ `node --version | sed -e 's/^v//' -e 's/\..*//g'` -lt 4 ]]
# If the node version is < 6, the script should just give an error.
nodeVersion=`node --version | cut -d v -f2`
nodeMajor=`echo $nodeVersion | cut -d. -f1`
nodeMinor=`echo $nodeVersion | cut -d. -f2`
if [[ nodeMajor -lt 6 ]]
then
cd $temp_app_path
err_output=`node "$root_path"/packages/create-react-app/index.js test-node-version 2>&1 > /dev/null || echo ''`
Expand Down

0 comments on commit e91ba24

Please sign in to comment.