Fail gracefully for node<4 in react-native-cli (const->var)

Summary:
`const` declarations were recently introduced into https://github.com/facebook/react-native/blob/master/react-native-cli/index.js, which runs before any transpilation so needs to be old-school. Replace them with `var`.

Fixes https://github.com/facebook/react-native/issues/11603
Closes https://github.com/facebook/react-native/pull/11615

Differential Revision: D5148448

Pulled By: shergin

fbshipit-source-id: ea23cdd26c0c1d0ac7f108aa9bf185abecfe399c
This commit is contained in:
Rob Hogan
2017-06-06 11:19:00 -07:00
committed by Facebook Github Bot
parent 46b3a89a70
commit 699a0bef3b

View File

@@ -26,6 +26,9 @@
// The only reason to modify this file is to add more warnings and
// troubleshooting information for the `react-native init` command.
//
// To allow for graceful failure on older node versions, this file should
// retain ES5 compatibility.
//
// Do not make breaking changes! We absolutely don't want to have to
// tell people to update their global version of react-native-cli.
//
@@ -266,9 +269,9 @@ function getInstallPackage(rnPackage) {
}
function run(root, projectName, options) {
const rnPackage = options.version; // e.g. '0.38' or '/path/to/archive.tgz'
const forceNpmClient = options.npm;
const yarnVersion = (!forceNpmClient) && getYarnVersionIfAvailable();
var rnPackage = options.version; // e.g. '0.38' or '/path/to/archive.tgz'
var forceNpmClient = options.npm;
var yarnVersion = (!forceNpmClient) && getYarnVersionIfAvailable();
var installCommand;
if (options.installCommand) {
// In CI environments it can be useful to provide a custom command,