Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use most recent React version #477

Merged
merged 5 commits into from
Aug 25, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Get latest version numbers of react and react-dom from npm before ins…
…tall.
  • Loading branch information
wdhorton committed Aug 23, 2016
commit 403631a1461bd40adde179760d485dcefb3c70e9
13 changes: 12 additions & 1 deletion scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
var fs = require('fs-extra');
var path = require('path');
var spawn = require('cross-spawn');
var spawnSync = require('cross-spawn').sync;
var pathExists = require('path-exists');
var chalk = require('chalk');

Expand All @@ -23,7 +24,17 @@ module.exports = function(appPath, appName, verbose, originalDirectory) {
appPackage.dependencies = appPackage.dependencies || {};
appPackage.devDependencies = appPackage.devDependencies || {};
['react', 'react-dom'].forEach(function (key) {
appPackage.dependencies[key] = ownPackage.devDependencies[key];
var args = [
'view',
key,
'version',
verbose && '--verbose'
].filter(function(e) { return e; });
var result = spawnSync('npm', args, {encoding: 'utf8'});

appPackage.dependencies[key] = result.status === 0 ?
'^' + result.stdout.trim() :
ownPackage.devDependencies[key];
});
['react-test-renderer'].forEach(function (key) {
appPackage.devDependencies[key] = ownPackage.devDependencies[key];
Expand Down