Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added info CLI command #14428

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions local-cli/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 47 additions & 0 deletions local-cli/info/info.js
Original file line number Diff line number Diff line change
@@ -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,
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down