mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-14 16:39:47 +08:00
Add --version to local-cli/cli.js
Summary: [Buck](https://buckbuild.com) has a concept of a versioned tool. In order to properly use RN with Buck, the `cli.js` script should return the proper version when passed `--version`. Reviewed By: astreet Differential Revision: D3197207 fb-gh-sync-id: 12ea35587cf492eb89d7dd102e93bdd26bc813c0 fbshipit-source-id: 12ea35587cf492eb89d7dd102e93bdd26bc813c0
This commit is contained in:
committed by
Facebook Github Bot 1
parent
850befa3cd
commit
856f9e9fed
@@ -30,6 +30,7 @@ var TerminalAdapter = require('yeoman-environment/lib/adapter.js');
|
||||
var yeoman = require('yeoman-environment');
|
||||
var unbundle = require('./bundle/unbundle');
|
||||
var upgrade = require('./upgrade/upgrade');
|
||||
var version = require('./version/version');
|
||||
|
||||
var fs = require('fs');
|
||||
var gracefulFs = require('graceful-fs');
|
||||
@@ -56,6 +57,7 @@ Object.keys(documentedCommands).forEach(function(command) {
|
||||
});
|
||||
|
||||
var undocumentedCommands = {
|
||||
'--version': [version, ''],
|
||||
'init': [printInitWarning, ''],
|
||||
};
|
||||
|
||||
|
||||
22
local-cli/version/version.js
Normal file
22
local-cli/version/version.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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';
|
||||
|
||||
var pkg = require('../../package');
|
||||
var Promise = require('promise');
|
||||
|
||||
/**
|
||||
* Prints the version of react-native and exits.
|
||||
*/
|
||||
function version(argv, config) {
|
||||
console.log(pkg.version);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
module.exports = version;
|
||||
Reference in New Issue
Block a user