added info CLI command
Summary: Many issues filed on Github are missing platform/toolchain version information. Others have different ways of writing it, and require the issue writer to look in multiple places for these versions. Other CLI tools like Ionic have this function, and it's incredibly useful. Related to https://github.com/facebook/react-native/issues/14420 Run in terminal/command prompt `react-native info` ``` trevors-imac:AwesomeProject tabrindle$ react-native info Versions: React Native: 1000.0.0 OS: macOS Sierra Node: v6.10.3 Yarn: 0.24.5 npm: 5.0.0 Xcode: Xcode 8.3.3 Build version 8E3004b ``` - CLA signed ✅ - Verify functionality + implementation Closes https://github.com/facebook/react-native/pull/14428 Differential Revision: D5392446 Pulled By: hramos fbshipit-source-id: 460079f3860c0af1e0b77bf26552c26032e974be
This commit is contained in:
parent
0681887347
commit
95ee3f5cab
|
@ -51,6 +51,7 @@ const documentedCommands = [
|
|||
require('./logAndroid/logAndroid'),
|
||||
require('./logIOS/logIOS'),
|
||||
require('./dependencies/dependencies'),
|
||||
require('./info/info'),
|
||||
];
|
||||
|
||||
// The user should never get here because projects are inited by
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* 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 envinfo = require('envinfo');
|
||||
|
||||
const info = function() {
|
||||
const args = Array.prototype.slice.call(arguments)[2];
|
||||
|
||||
try {
|
||||
envinfo.print({
|
||||
packages: typeof args.packages === 'string' ? ['react', 'react-native'].concat(args.packages.split(',')) : args.packages
|
||||
});
|
||||
} catch (error) {
|
||||
console.log('Error: unable to print environment info');
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
name: 'info',
|
||||
description: 'Get relevant version info about OS, toolchain and libraries',
|
||||
options: [
|
||||
{
|
||||
command: '--packages [string]',
|
||||
description: 'Which packages from your package.json to include, in addition to the default React Native and React versions.',
|
||||
default: ['react', 'react-native']
|
||||
},
|
||||
],
|
||||
examples: [
|
||||
{
|
||||
desc: 'Get standard version info',
|
||||
cmd: 'react-native info',
|
||||
},
|
||||
{
|
||||
desc: 'Get standard version info & specified package versions',
|
||||
cmd: 'react-native info --packages jest,eslint,babel-polyfill',
|
||||
}
|
||||
],
|
||||
func: info,
|
||||
};
|
|
@ -166,6 +166,7 @@
|
|||
"create-react-class": "^15.5.2",
|
||||
"debug": "^2.2.0",
|
||||
"denodeify": "^1.2.1",
|
||||
"envinfo": "^3.0.0",
|
||||
"errno": ">=0.1.1 <0.2.0-0",
|
||||
"event-target-shim": "^1.0.5",
|
||||
"fbjs": "0.8.12",
|
||||
|
|
Loading…
Reference in New Issue