From 794f9b252640f41326def1d98fc2bcbfba146f73 Mon Sep 17 00:00:00 2001 From: Ali Waseem Date: Thu, 17 Oct 2019 13:22:05 -0600 Subject: [PATCH 1/2] added check for typescript template and unsupported node version --- packages/create-react-app/createReactApp.js | 32 ++++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/packages/create-react-app/createReactApp.js b/packages/create-react-app/createReactApp.js index 5a377d278e6..ee80f32d3b4 100755 --- a/packages/create-react-app/createReactApp.js +++ b/packages/create-react-app/createReactApp.js @@ -193,6 +193,27 @@ function createApp( useTypescript, template ) { + const unSupportedNodeVersion = !semver.satisfies(process.version, '>=8.10.0'); + if (unSupportedNodeVersion && useTypescript) { + console.log( + chalk.yellow( + `You are using Node ${process.version} with the TypeScript template. Since the old unsuporoted version of tools do not supported TypeScript, you will have to upgrade.\n\n` + + `Please update to Node 8.10 or higher for a better, fully supported experience.\n` + ) + ); + + process.exit(1); + } else 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` + ) + ); + // Fall back to latest supported react-scripts on Node 4 + version = 'react-scripts@0.9.x'; + } + const root = path.resolve(name); const appName = path.basename(root); @@ -222,17 +243,6 @@ function createApp( process.exit(1); } - if (!semver.satisfies(process.version, '>=8.10.0')) { - 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` - ) - ); - // Fall back to latest supported react-scripts on Node 4 - version = 'react-scripts@0.9.x'; - } - if (!useYarn) { const npmInfo = checkNpmVersion(); if (!npmInfo.hasMinNpm) { From 1ec7efe37050611a5bda681e2f9aa796d0212594 Mon Sep 17 00:00:00 2001 From: Ali Waseem Date: Thu, 17 Oct 2019 16:31:30 -0600 Subject: [PATCH 2/2] addressed code review feedback regarding syntax and spelling mistakes --- packages/create-react-app/createReactApp.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/create-react-app/createReactApp.js b/packages/create-react-app/createReactApp.js index ee80f32d3b4..d9980c81375 100755 --- a/packages/create-react-app/createReactApp.js +++ b/packages/create-react-app/createReactApp.js @@ -193,17 +193,16 @@ function createApp( useTypescript, template ) { - const unSupportedNodeVersion = !semver.satisfies(process.version, '>=8.10.0'); - if (unSupportedNodeVersion && useTypescript) { + const unsupportedNodeVersion = !semver.satisfies(process.version, '>=8.10.0'); + if (unsupportedNodeVersion && useTypescript) { console.log( - chalk.yellow( - `You are using Node ${process.version} with the TypeScript template. Since the old unsuporoted version of tools do not supported TypeScript, you will have to upgrade.\n\n` + - `Please update to Node 8.10 or higher for a better, fully supported experience.\n` + 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) { + } else 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` +