Made react installed via reac-native init strict to unbreak 15.1.0
Summary: React@15.1.0 is incompatible with React-Native@0.26. This PR was cherry-picked to 0.26-stable branch now. What this change does: - react-native-cli (major release bump) saves exact versions of react-native and react (only in npm2) dependencies into package.json - local-cli saves exact version of react (only npm3) dependency into package.json Closes https://github.com/facebook/react-native/pull/7879 Differential Revision: D3384705 Pulled By: davidaurelio fbshipit-source-id: d4dff418f9659bd083ae8826433a4e7c0355d03b
This commit is contained in:
parent
5de1151bdd
commit
f22e9353a7
|
@ -107,6 +107,6 @@ module.exports = yeoman.generators.NamedBase.extend({
|
|||
return;
|
||||
}
|
||||
|
||||
this.npmInstall(`react@${reactVersion}`, { '--save': true });
|
||||
this.npmInstall(`react@${reactVersion}`, { '--save': true, '--save-exact': true });
|
||||
}
|
||||
});
|
||||
|
|
|
@ -213,11 +213,11 @@ function getInstallPackage(rnPackage) {
|
|||
}
|
||||
|
||||
function run(root, projectName, rnPackage) {
|
||||
exec('npm install --save ' + getInstallPackage(rnPackage), function(e, stdout, stderr) {
|
||||
exec('npm install --save --save-exact ' + getInstallPackage(rnPackage), function(e, stdout, stderr) {
|
||||
if (e) {
|
||||
console.log(stdout);
|
||||
console.error(stderr);
|
||||
console.error('`npm install --save react-native` failed');
|
||||
console.error('`npm install --save --save-exact react-native` failed');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
@ -229,10 +229,10 @@ function run(root, projectName, rnPackage) {
|
|||
}
|
||||
|
||||
function runVerbose(root, projectName, rnPackage) {
|
||||
var proc = spawn('npm', ['install', '--verbose', '--save', getInstallPackage(rnPackage)], {stdio: 'inherit'});
|
||||
var proc = spawn('npm', ['install', '--verbose', '--save', '--save-exact', getInstallPackage(rnPackage)], {stdio: 'inherit'});
|
||||
proc.on('close', function (code) {
|
||||
if (code !== 0) {
|
||||
console.error('`npm install --save react-native` failed');
|
||||
console.error('`npm install --save --save-exact react-native` failed');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "react-native-cli",
|
||||
"version": "0.2.0",
|
||||
"version": "1.0.0",
|
||||
"license": "BSD-3-Clause",
|
||||
"description": "The React Native CLI tools",
|
||||
"main": "index.js",
|
||||
|
|
Loading…
Reference in New Issue