diff --git a/azure-pipelines-test-job.yml b/azure-pipelines-test-job.yml index 7073bf3eab6..e3b9d92b669 100644 --- a/azure-pipelines-test-job.yml +++ b/azure-pipelines-test-job.yml @@ -6,10 +6,10 @@ parameters: name: '' testScript: '' configurations: - LinuxNode8: { vmImage: 'ubuntu-16.04', nodeVersion: 8.x } LinuxNode10: { vmImage: 'ubuntu-16.04', nodeVersion: 10.x } - # WindowsNode8: { vmImage: 'vs2017-win2016', nodeVersion: 8.x } - # WindowsNode10: { vmImage: 'vs2017-win2016', nodeVersion: 10.x } + LinuxNode12: { vmImage: 'ubuntu-16.04', nodeVersion: 12.x } + # WindowsNode10: { vmImage: 'windows-latest', nodeVersion: 10.x } + # WindowsNode12: { vmImage: 'windows-latest', nodeVersion: 12.x } jobs: - job: ${{ parameters.name }} diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8021fb92668..6f9f49df877 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -57,36 +57,23 @@ jobs: name: Behavior testScript: tasks/e2e-behavior.sh configurations: - LinuxNode8: { vmImage: 'ubuntu-18.04', nodeVersion: 8.x } - LinuxNode10: { vmImage: 'ubuntu-18.04', nodeVersion: 10.x } - # WindowsNode8: { vmImage: 'vs2017-win2016', nodeVersion: 8.x } - # WindowsNode10: { vmImage: 'vs2017-win2016', nodeVersion: 10.x } - MacNode8: { vmImage: 'macOS-10.15', nodeVersion: 8.x } - MacNode10: { vmImage: 'macOS-10.15', nodeVersion: 10.x } + LinuxNode10: { vmImage: 'ubuntu-16.04', nodeVersion: 10.x } + LinuxNode12: { vmImage: 'ubuntu-16.04', nodeVersion: 12.x } + # WindowsNode10: { vmImage: 'windows-latest', nodeVersion: 10.x } + # WindowsNode12: { vmImage: 'windows-latest', nodeVersion: 12.x } + MacNode10: { vmImage: 'macOS-latest', nodeVersion: 10.x } + MacNode12: { vmImage: 'macOS-latest', nodeVersion: 12.x } # ****************************************************************************** # Old Node test suite # ****************************************************************************** - job: OldNode pool: - vmImage: ubuntu-16.04 + vmImage: ubuntu-latest steps: - task: NodeTool@0 inputs: - versionSpec: 6.x - displayName: 'Install Node.js 6.x' + versionSpec: 8.x + displayName: 'Install Node.js 8.x' - bash: tasks/e2e-old-node.sh displayName: 'Run tests' - # ****************************************************************************** - # Unsupported Node with TypeScript flag - # ****************************************************************************** - - job: UnsupportedNodeWithTypeScript - pool: - vmImage: ubuntu-16.04 - steps: - - task: NodeTool@0 - inputs: - versionSpec: 8.9.x - displayName: 'Install Node.js 8.9.x' - - bash: tasks/e2e-typescript-unsupported-node.sh - displayName: 'Run unsupported TypeScript test' diff --git a/docusaurus/docs/getting-started.md b/docusaurus/docs/getting-started.md index f23236110b3..9418ca03c07 100644 --- a/docusaurus/docs/getting-started.md +++ b/docusaurus/docs/getting-started.md @@ -34,7 +34,7 @@ Create a project, and you’re good to go. ## Creating an App -**You’ll need to have Node >= 8.10 on your local development machine** (but it’s not required on the server). You can use [nvm](https://github.com/creationix/nvm#installation) (macOS/Linux) or [nvm-windows](https://github.com/coreybutler/nvm-windows#node-version-manager-nvm-for-windows) to switch Node versions between different projects. +**You’ll need to have Node >= 10 on your local development machine** (but it’s not required on the server). You can use [nvm](https://github.com/creationix/nvm#installation) (macOS/Linux) or [nvm-windows](https://github.com/coreybutler/nvm-windows#node-version-manager-nvm-for-windows) to switch Node versions between different projects. To create a new app, you may choose one of the following methods: diff --git a/package.json b/package.json index cef165341b1..e48fb86d1ee 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "meow": "^5.0.0", "multimatch": "^3.0.0", "prettier": "1.19.1", - "puppeteer": "^2.0.0", + "puppeteer": "^3.0.2", "strip-ansi": "^5.1.0", "svg-term-cli": "^2.1.1", "tempy": "^0.2.1", diff --git a/packages/cra-template-typescript/package.json b/packages/cra-template-typescript/package.json index 4c16d0c0a3a..5b3936acf4c 100644 --- a/packages/cra-template-typescript/package.json +++ b/packages/cra-template-typescript/package.json @@ -15,7 +15,7 @@ }, "license": "MIT", "engines": { - "node": ">=8.10" + "node": ">=10" }, "bugs": { "url": "https://github.com/facebook/create-react-app/issues" diff --git a/packages/cra-template/package.json b/packages/cra-template/package.json index f28004102ff..d34d8229b6f 100644 --- a/packages/cra-template/package.json +++ b/packages/cra-template/package.json @@ -14,7 +14,7 @@ }, "license": "MIT", "engines": { - "node": ">=8" + "node": ">=10" }, "bugs": { "url": "https://github.com/facebook/create-react-app/issues" diff --git a/packages/create-react-app/createReactApp.js b/packages/create-react-app/createReactApp.js index 4d39b208767..f8c50fbd51d 100755 --- a/packages/create-react-app/createReactApp.js +++ b/packages/create-react-app/createReactApp.js @@ -203,20 +203,12 @@ function createApp( usePnp, useTypeScript ) { - const unsupportedNodeVersion = !semver.satisfies(process.version, '>=8.10.0'); - if (unsupportedNodeVersion && useTypeScript) { - console.error( - chalk.red( - `You are using Node ${process.version} with the TypeScript template. Node 8.10 or higher is required to use TypeScript.\n` - ) - ); - - process.exit(1); - } else if (unsupportedNodeVersion) { + const unsupportedNodeVersion = !semver.satisfies(process.version, '>=10'); + if (unsupportedNodeVersion) { console.log( chalk.yellow( `You are using Node ${process.version} so the project will be bootstrapped with an old unsupported version of tools.\n\n` + - `Please update to Node 8.10 or higher for a better, fully supported experience.\n` + `Please update to Node 10 or higher for a better, fully supported experience.\n` ) ); // Fall back to latest supported react-scripts on Node 4 @@ -260,7 +252,7 @@ function createApp( console.log( chalk.yellow( `You are using npm ${npmInfo.npmVersion} so the project will be bootstrapped with an old unsupported version of tools.\n\n` + - `Please update to npm 5 or higher for a better, fully supported experience.\n` + `Please update to npm 6 or higher for a better, fully supported experience.\n` ) ); } @@ -516,7 +508,7 @@ function run( console.log( chalk.yellow( `\nNote: the project was bootstrapped with an old unsupported version of tools.\n` + - `Please update to Node >=8.10 and npm >=5 to get supported tools in new projects.\n` + `Please update to Node >=10 and npm >=6 to get supported tools in new projects.\n` ) ); } @@ -771,7 +763,7 @@ function checkNpmVersion() { npmVersion = execSync('npm --version') .toString() .trim(); - hasMinNpm = semver.gte(npmVersion, '5.0.0'); + hasMinNpm = semver.gte(npmVersion, '6.0.0'); } catch (err) { // ignore } diff --git a/packages/create-react-app/index.js b/packages/create-react-app/index.js index b26463f2e8a..1e068819f48 100755 --- a/packages/create-react-app/index.js +++ b/packages/create-react-app/index.js @@ -40,12 +40,12 @@ var currentNodeVersion = process.versions.node; var semver = currentNodeVersion.split('.'); var major = semver[0]; -if (major < 8) { +if (major < 10) { console.error( 'You are running Node ' + currentNodeVersion + '.\n' + - 'Create React App requires Node 8 or higher. \n' + + 'Create React App requires Node 10 or higher. \n' + 'Please update your version of Node.' ); process.exit(1); diff --git a/packages/create-react-app/package.json b/packages/create-react-app/package.json index 3e637270d52..2ef15e8ebdd 100644 --- a/packages/create-react-app/package.json +++ b/packages/create-react-app/package.json @@ -12,7 +12,7 @@ }, "license": "MIT", "engines": { - "node": ">=8" + "node": ">=10" }, "bugs": { "url": "https://github.com/facebook/create-react-app/issues" diff --git a/packages/react-app-polyfill/package.json b/packages/react-app-polyfill/package.json index b48d4f185e1..21fc0986a5f 100644 --- a/packages/react-app-polyfill/package.json +++ b/packages/react-app-polyfill/package.json @@ -12,7 +12,7 @@ "url": "https://github.com/facebook/create-react-app/issues" }, "engines": { - "node": ">=6" + "node": ">=10" }, "files": [ "ie9.js", diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index 9af96ca4471..d4aa78a8c28 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -12,7 +12,7 @@ "url": "https://github.com/facebook/create-react-app/issues" }, "engines": { - "node": ">=8.10" + "node": ">=10" }, "files": [ "browsersHelper.js", diff --git a/packages/react-scripts/fixtures/kitchensink/template.json b/packages/react-scripts/fixtures/kitchensink/template.json index ca3e4aece9c..9c756ffa8a1 100644 --- a/packages/react-scripts/fixtures/kitchensink/template.json +++ b/packages/react-scripts/fixtures/kitchensink/template.json @@ -3,7 +3,7 @@ "dependencies": { "bootstrap": "4.3.1", "jest": "25.5.4", - "node-sass": "4.12.0", + "node-sass": "4.x", "normalize.css": "7.0.0", "prop-types": "15.7.2", "test-integrity": "2.0.1" diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 01afbb1faaa..0392f4c200d 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -9,7 +9,7 @@ }, "license": "MIT", "engines": { - "node": ">=8.10" + "node": ">=10" }, "bugs": { "url": "https://github.com/facebook/create-react-app/issues" diff --git a/tasks/e2e-old-node.sh b/tasks/e2e-old-node.sh index 8245dd24e50..1022662ce81 100755 --- a/tasks/e2e-old-node.sh +++ b/tasks/e2e-old-node.sh @@ -52,7 +52,7 @@ cd "$root_path"/packages/create-react-app npm install cd "$root_path" -# If the node version is < 6, the script should just give an error. +# If the node version is < 10, the script should just give an error. cd $temp_app_path err_output=`node "$root_path"/packages/create-react-app/index.js test-node-version 2>&1 > /dev/null || echo ''` [[ $err_output =~ You\ are\ running\ Node ]] && exit 0 || exit 1 diff --git a/tasks/e2e-typescript-unsupported-node.sh b/tasks/e2e-typescript-unsupported-node.sh deleted file mode 100755 index 0be6e6b4636..00000000000 --- a/tasks/e2e-typescript-unsupported-node.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# Copyright (c) 2015-present, Facebook, Inc. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# ****************************************************************************** -# This is an end-to-end test intended to run on CI. -# You can also run it locally but it's slow. -# ****************************************************************************** - -# Start in tasks/ even if run from root directory -cd "$(dirname "$0")" - -temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'` - -function cleanup { - echo 'Cleaning up.' - cd "$root_path" - rm -rf $temp_app_path -} - -# Error messages are redirected to stderr -function handle_error { - echo "$(basename $0): ERROR! An error was encountered executing line $1." 1>&2; - cleanup - echo 'Exiting with error.' 1>&2; - exit 1 -} - -function handle_exit { - cleanup - echo 'Exiting without error.' 1>&2; - exit -} - -# Exit the script with a helpful error message when any error is encountered -trap 'set +x; handle_error $LINENO $BASH_COMMAND' ERR - -# Cleanup before exit on any termination signal -trap 'set +x; handle_exit' SIGQUIT SIGTERM SIGINT SIGKILL SIGHUP - -# Echo every command being executed -set -x - -# Go to root -cd .. -root_path=$PWD - -# We need to install create-react-app deps to test it -cd "$root_path"/packages/create-react-app -npm install -cd "$root_path" - -# If the node version is < 8.10 but greater then 8.0, the script with the typescript flag should just give an error. -cd $temp_app_path -err_output=`node "$root_path"/packages/create-react-app/index.js test-node-version --typescript 2>&1 > /dev/null || echo ''` -[[ $err_output =~ You\ are\ using\ Node ]] && exit 0 || exit 1 - -# Cleanup -cleanup diff --git a/tasks/local-test.sh b/tasks/local-test.sh index 4a66726907a..d8005eda154 100755 --- a/tasks/local-test.sh +++ b/tasks/local-test.sh @@ -49,7 +49,7 @@ while [ "$1" != "" ]; do shift done -test_command="./tasks/e2e-simple.sh && ./tasks/e2e-kitchensink.sh && ./tasks/e2e-kitchensink-eject.sh && ./tasks/e2e-installs.sh" +test_command="./tasks/e2e-simple.sh && ./tasks/e2e-kitchensink.sh && ./tasks/e2e-kitchensink-eject.sh && ./tasks/e2e-installs.sh && ./tasks/e2e-behavior.sh" case ${test_suite} in "all") ;; diff --git a/test/fixtures/webpack-message-formatting/__snapshots__/index.test.js.snap b/test/fixtures/webpack-message-formatting/__snapshots__/index.test.js.snap index 9d67e100720..91042386d01 100644 --- a/test/fixtures/webpack-message-formatting/__snapshots__/index.test.js.snap +++ b/test/fixtures/webpack-message-formatting/__snapshots__/index.test.js.snap @@ -156,21 +156,6 @@ Failed to compile. Attempted import error: 'bar' is not exported from './AppUnknownExport'. -", - "stdout": "", -} -`; - -exports[`helps when users tries to use sass 1`] = ` -Object { - "stderr": "Creating an optimized production build... -Failed to compile. - -./src/AppSass.scss -To import Sass files, you first need to install node-sass. -Run \`npm install node-sass\` or \`yarn add node-sass\` inside your workspace. - - ", "stdout": "", } diff --git a/test/fixtures/webpack-message-formatting/index.test.js b/test/fixtures/webpack-message-formatting/index.test.js index f102b1cf381..977bf277a5e 100644 --- a/test/fixtures/webpack-message-formatting/index.test.js +++ b/test/fixtures/webpack-message-formatting/index.test.js @@ -97,7 +97,11 @@ test('helps when users tries to use sass', async () => { ); const { stdout, stderr } = await testSetup.scripts.build(); - expect({ stdout, stderr }).toMatchSnapshot(); + expect(stdout).toBeFalsy(); + // TODO: Snapshots differ between Node 10/12 as the call stack log output has changed. + expect(stderr).toContain( + 'To import Sass files, you first need to install node-sass.' + ); }); test('formats file not found error', async () => {