feat(v2-cli): Added new environment info command (#1410)

* Adds new info command

Shows up essential debugging information about the environment

* Minor fix

* Remove npmGlobalPackages from envinfo

* Fix up glob pattern

* Minor fix

* Update glob pattern

* fix envinfo glob pattern and params

* prettier

* simplify glob
This commit is contained in:
James George 2019-05-01 19:54:45 +05:30 committed by Endi
parent 76d210f1f1
commit 5030952a8f
2 changed files with 18 additions and 0 deletions

View file

@ -8,6 +8,7 @@
*/
const chalk = require('chalk');
const envinfo = require('envinfo');
const semver = require('semver');
const path = require('path');
const program = require('commander');
@ -94,6 +95,22 @@ program
});
});
program
.command('info')
.description('Shows debugging information about the local environment')
.action(() => {
console.log(chalk.bold('\nEnvironment Info:'));
envinfo
.run({
System: ['OS', 'CPU'],
Binaries: ['Node', 'Yarn', 'npm'],
Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'],
npmPackages: '?(@)docusaurus{*,*/**}',
npmGlobalPackages: '?(@)docusaurus{*,*/**}',
})
.then(console.log);
});
program.arguments('<command>').action(cmd => {
program.outputHelp();
console.log(` ${chalk.red(`\n Unknown command ${chalk.yellow(cmd)}.`)}`);

View file

@ -47,6 +47,7 @@
"css-loader": "^1.0.0",
"docsearch.js": "^2.5.2",
"ejs": "^2.6.1",
"envinfo": "^7.2.0",
"express": "^4.16.4",
"front-matter": "^3.0.1",
"fs-extra": "^7.0.0",