Permalink
Browse files

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 #11603
Closes #11615

Differential Revision: D5148448

Pulled By: shergin

fbshipit-source-id: ea23cdd26c0c1d0ac7f108aa9bf185abecfe399c
  • Loading branch information...
rh389 authored and facebook-github-bot committed Jun 6, 2017
1 parent 46b3a89 commit 699a0bef3b2e6be3544db2486af5fdf18b224372
Showing with 6 additions and 3 deletions.
  1. +6 −3 react-native-cli/index.js
@@ -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,

0 comments on commit 699a0be

Please sign in to comment.