mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-27 22:54:46 +08:00
Move private-cli commands to local-cli
Summary: public We cannot remove `local-cli` because is referenced by the global cli explicitly. If we do so, people would have to upgrate this global thin cli which will cause some pain. So, lets move `private-cli` commands into `local-cli` instead. Reviewed By: frantic Differential Revision: D2571983 fb-gh-sync-id: 712c29430203660fb6f0d5f23813cb2a7156ee48
This commit is contained in:
committed by
facebook-github-bot-3
parent
24537e3726
commit
849aa4dae6
40
local-cli/server/checkNodeVersion.js
Normal file
40
local-cli/server/checkNodeVersion.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const chalk = require('chalk');
|
||||
const formatBanner = require('./formatBanner');
|
||||
const semver = require('semver');
|
||||
|
||||
module.exports = function() {
|
||||
if (!semver.satisfies(process.version, '>=4')) {
|
||||
const engine = semver.satisfies(process.version, '<1 >=4')
|
||||
? 'Node'
|
||||
: 'io.js';
|
||||
|
||||
const message = 'You are currently running ' + engine + ' ' +
|
||||
process.version + '.\n' +
|
||||
'\n' +
|
||||
'React Native runs on Node 4.0 or newer. There are several ways to ' +
|
||||
'upgrade Node.js depending on your preference.\n' +
|
||||
'\n' +
|
||||
'nvm: nvm install node && nvm alias default node\n' +
|
||||
'Homebrew: brew unlink iojs; brew install node\n' +
|
||||
'Installer: download the Mac .pkg from https://nodejs.org/\n' +
|
||||
'\n' +
|
||||
'About Node.js: https://nodejs.org\n' +
|
||||
'Follow along at: https://github.com/facebook/react-native/issues/2545';
|
||||
console.log(formatBanner(message, {
|
||||
chalkFunction: chalk.green,
|
||||
marginLeft: 1,
|
||||
marginRight: 1,
|
||||
paddingBottom: 1,
|
||||
}));
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user