From 4769fcc8b6f185510f8583e5f16333199ac397d7 Mon Sep 17 00:00:00 2001 From: William Horton Date: Thu, 25 Aug 2016 06:32:11 -0400 Subject: [PATCH] Use most recent React version (#477) * Get latest version numbers of react and react-dom from npm before install. * Run separate npm installs for react, react-dom, and react-test-renderer. * Consolidate into a single npm install. * Fix misplaced parenthesis, add missing semicolon. * Add missing semicolon. --- scripts/init.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/init.js b/scripts/init.js index 074fe428aef..14ace414295 100644 --- a/scripts/init.js +++ b/scripts/init.js @@ -17,17 +17,10 @@ module.exports = function(appPath, appName, verbose, originalDirectory) { var ownPath = path.join(appPath, 'node_modules', 'react-scripts'); var appPackage = require(path.join(appPath, 'package.json')); - var ownPackage = require(path.join(ownPath, 'package.json')); // Copy over some of the devDependencies appPackage.dependencies = appPackage.dependencies || {}; appPackage.devDependencies = appPackage.devDependencies || {}; - ['react', 'react-dom'].forEach(function (key) { - appPackage.dependencies[key] = ownPackage.devDependencies[key]; - }); - ['react-test-renderer'].forEach(function (key) { - appPackage.devDependencies[key] = ownPackage.devDependencies[key]; - }); // Setup the script rules appPackage.scripts = {}; @@ -74,6 +67,10 @@ module.exports = function(appPath, appName, verbose, originalDirectory) { // TODO: having to do two npm installs is bad, can we avoid it? var args = [ 'install', + 'react', + 'react-dom', + 'react-test-renderer', + '--save', verbose && '--verbose' ].filter(function(e) { return e; }); var proc = spawn('npm', args, {stdio: 'inherit'});