Skip to content

Commit

Permalink
Use most recent React version (facebook#477)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
wdhorton authored and George Czabania committed Sep 7, 2016
1 parent c6cf02d commit 0734b37
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -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'});
Expand Down

0 comments on commit 0734b37

Please sign in to comment.