mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-03 11:22:30 +02:00
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:
parent
76d210f1f1
commit
5030952a8f
2 changed files with 18 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const chalk = require('chalk');
|
const chalk = require('chalk');
|
||||||
|
const envinfo = require('envinfo');
|
||||||
const semver = require('semver');
|
const semver = require('semver');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const program = require('commander');
|
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.arguments('<command>').action(cmd => {
|
||||||
program.outputHelp();
|
program.outputHelp();
|
||||||
console.log(` ${chalk.red(`\n Unknown command ${chalk.yellow(cmd)}.`)}`);
|
console.log(` ${chalk.red(`\n Unknown command ${chalk.yellow(cmd)}.`)}`);
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
"css-loader": "^1.0.0",
|
"css-loader": "^1.0.0",
|
||||||
"docsearch.js": "^2.5.2",
|
"docsearch.js": "^2.5.2",
|
||||||
"ejs": "^2.6.1",
|
"ejs": "^2.6.1",
|
||||||
|
"envinfo": "^7.2.0",
|
||||||
"express": "^4.16.4",
|
"express": "^4.16.4",
|
||||||
"front-matter": "^3.0.1",
|
"front-matter": "^3.0.1",
|
||||||
"fs-extra": "^7.0.0",
|
"fs-extra": "^7.0.0",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue