diff --git a/react-native-cli/index.js b/react-native-cli/index.js index cdb228de4637f4..b5c9c7b7ebb199 100755 --- a/react-native-cli/index.js +++ b/react-native-cli/index.js @@ -74,7 +74,10 @@ var REACT_NATIVE_PACKAGE_JSON_PATH = function() { 'package.json' ); }; -checkForVersionArgument(options); + +if (options._.length === 0 && (options.v || options.version)) { + printVersionsAndExit(REACT_NATIVE_PACKAGE_JSON_PATH()); +} // Use Yarn if available, it's much faster than the npm client. // Return the version of yarn installed on the system, null if yarn is not available. @@ -315,14 +318,12 @@ function checkNodeVersion() { } } -function checkForVersionArgument(options) { - if (options._.length === 0 && (options.v || options.version)) { - console.log('react-native-cli: ' + require('./package.json').version); - try { - console.log('react-native: ' + require(REACT_NATIVE_PACKAGE_JSON_PATH()).version); - } catch (e) { - console.log('react-native: n/a - not inside a React Native project directory'); - } - process.exit(); +function printVersionsAndExit(reactNativePackageJsonPath) { + console.log('react-native-cli: ' + require('./package.json').version); + try { + console.log('react-native: ' + require(reactNativePackageJsonPath).version); + } catch (e) { + console.log('react-native: n/a - not inside a React Native project directory'); } + process.exit(); } diff --git a/react-native-cli/package.json b/react-native-cli/package.json index 5473761811e1ed..1d7498c49a6757 100644 --- a/react-native-cli/package.json +++ b/react-native-cli/package.json @@ -1,6 +1,6 @@ { "name": "react-native-cli", - "version": "2.0.0", + "version": "2.0.1", "license": "BSD-3-Clause", "description": "The React Native CLI tools", "main": "index.js",