Skip to content

Commit 0734b37

Browse files
wdhortonGeorge Czabania
authored and
George Czabania
committed
Use most recent React version (facebook#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.
1 parent c6cf02d commit 0734b37

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

scripts/init.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,10 @@ module.exports = function(appPath, appName, verbose, originalDirectory) {
1717
var ownPath = path.join(appPath, 'node_modules', 'react-scripts');
1818

1919
var appPackage = require(path.join(appPath, 'package.json'));
20-
var ownPackage = require(path.join(ownPath, 'package.json'));
2120

2221
// Copy over some of the devDependencies
2322
appPackage.dependencies = appPackage.dependencies || {};
2423
appPackage.devDependencies = appPackage.devDependencies || {};
25-
['react', 'react-dom'].forEach(function (key) {
26-
appPackage.dependencies[key] = ownPackage.devDependencies[key];
27-
});
28-
['react-test-renderer'].forEach(function (key) {
29-
appPackage.devDependencies[key] = ownPackage.devDependencies[key];
30-
});
3124

3225
// Setup the script rules
3326
appPackage.scripts = {};
@@ -74,6 +67,10 @@ module.exports = function(appPath, appName, verbose, originalDirectory) {
7467
// TODO: having to do two npm installs is bad, can we avoid it?
7568
var args = [
7669
'install',
70+
'react',
71+
'react-dom',
72+
'react-test-renderer',
73+
'--save',
7774
verbose && '--verbose'
7875
].filter(function(e) { return e; });
7976
var proc = spawn('npm', args, {stdio: 'inherit'});

0 commit comments

Comments
 (0)