Skip to content

Commit c39b804

Browse files
tabrindlefacebook-github-bot
authored andcommitted
cli: upgrade envinfo for new features in react-native info
Summary: envinfo has done a good job reporting issues in the issue template so far, and I've done a lot of work between version 3.x and 5.x that react-native could benefit from. This adds: - better information organization, including versions and paths - Platform/CPU/RAM - Android and iOS SDK version detection - npm package globbing (select all babel* packages - global npm packages (with globbing) envinfo also can report IDE versions, other binaries, languages and browsers if needed, and in different formats. Take a look here if interested: https://github.com/tabrindle/envinfo - run `react-native info` // standard info - run `react-native info --packages` // all packages in package.json - run `react-native info --packages jest,eslint,babel-polyfill` // specified packages - run `react-native info --packages *babel*` // globbed packages Sample standard output: ``` System: OS: macOS High Sierra 10.13 CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz Memory: 97.59 MB / 16.00 GB Shell: 5.4.2 - /usr/local/bin/zsh Binaries: Node: 8.11.0 - ~/.nvm/versions/node/v8.11.0/bin/node Yarn: 1.5.1 - ~/.yarn/bin/yarn npm: 5.6.0 - ~/.nvm/versions/node/v8.11.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0 Android SDK: Build Tools: 27.0.3 API Levels: 26 IDEs: Android Studio: 3.0 AI-171.4443003 Xcode: 9.0/9A235 - /usr/bin/xcodebuild npmPackages: react: 16.3.2 => 16.3.2 react-native: 0.55.0 => 0.55.0 npmGlobalPackages: create-react-native-app: 1.0.0 react-native-cli: 2.0.1 ``` #14428 - original inclusion of `react-native info` [CLI] [ENHANCEMENT] [local-cli/info/info.js] - add more info to react-native info cli command, like global npm packages, binary paths, and SDK versions Closes #19331 Differential Revision: D8049650 Pulled By: hramos fbshipit-source-id: 35c677f369bcad1a014eb083b2ce60ba33fee0ea
1 parent b3b72bb commit c39b804

2 files changed

Lines changed: 44 additions & 11 deletions

File tree

local-cli/info/info.js

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,36 @@ const info = function() {
1515
const args = Array.prototype.slice.call(arguments)[2];
1616

1717
try {
18-
envinfo.print({
19-
packages:
20-
typeof args.packages === 'string'
21-
? ['react', 'react-native'].concat(args.packages.split(','))
22-
: args.packages,
23-
});
24-
} catch (error) {
18+
envinfo
19+
.run(
20+
{
21+
System: ['OS', 'CPU', 'Memory', 'Shell'],
22+
Binaries: ['Node', 'Yarn', 'npm', 'Watchman'],
23+
IDEs: ['Xcode', 'Android Studio'],
24+
SDKs: ['iOS SDK', 'Android SDK'],
25+
npmPackages:
26+
(typeof args.packages === 'string' &&
27+
!args.packages.includes('*')) ||
28+
!args.packages
29+
? ['react', 'react-native'].concat(
30+
(args.packages || '').split(','),
31+
)
32+
: args.packages,
33+
npmGlobalPackages: '*react-native*',
34+
},
35+
{
36+
clipboard: !!args.clipboard,
37+
title: 'React Native Environment Info',
38+
},
39+
)
40+
.then(console.log)
41+
.catch(err => {
42+
console.log('Error: unable to print environment info');
43+
console.log(err);
44+
});
45+
} catch (err) {
2546
console.log('Error: unable to print environment info');
26-
console.log(error);
47+
console.log(err);
2748
}
2849
};
2950

@@ -35,7 +56,11 @@ module.exports = {
3556
command: '--packages [string]',
3657
description:
3758
'Which packages from your package.json to include, in addition to the default React Native and React versions.',
38-
default: ['react', 'react-native'],
59+
},
60+
{
61+
command: '--clipboard [boolean]',
62+
description:
63+
'Automagically copy the environment report output to the clipboard',
3964
},
4065
],
4166
examples: [
@@ -45,7 +70,15 @@ module.exports = {
4570
},
4671
{
4772
desc: 'Get standard version info & specified package versions',
48-
cmd: 'react-native info --packages jest,eslint,babel-polyfill',
73+
cmd: 'react-native info --packages jest,eslint',
74+
},
75+
{
76+
desc: 'Get standard version info & globbed package versions',
77+
cmd: 'react-native info --packages "*react*"',
78+
},
79+
{
80+
desc: 'Get standard version info & all package versions',
81+
cmd: 'react-native info --packages',
4982
},
5083
],
5184
func: info,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
"create-react-class": "^15.6.3",
157157
"debug": "^2.2.0",
158158
"denodeify": "^1.2.1",
159-
"envinfo": "^3.0.0",
159+
"envinfo": "^5.7.0",
160160
"errorhandler": "^1.5.0",
161161
"escape-string-regexp": "^1.0.5",
162162
"event-target-shim": "^1.0.5",

0 commit comments

Comments
 (0)