Skip to content

Commit 3eeb080

Browse files
jamesgeorge007ulivz
authored andcommitted
feat($core): info command (#1573)
1 parent 3c560d1 commit 3eeb080

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

packages/docs/docs/api/cli.md

+4
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ do not clear screen when dev server is ready.
4646

4747
Copy the default theme into `.vuepress/theme` for customization.
4848

49+
## info
50+
51+
Shows debugging information about the local environment.
52+
4953
## more commands
5054

5155
You can create a custom command with [extendCli](../plugin/option-api.md#extendcli).

packages/vuepress/lib/registerCoreCommands.js

+22
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* Module dependencies.
55
*/
66

7+
const { chalk } = require('@vuepress/shared-utils')
8+
const envinfo = require('envinfo')
9+
710
const { dev, build, eject } = require('@vuepress/core')
811
const { path, logger, env } = require('@vuepress/shared-utils')
912
const { wrapCommand } = require('./util')
@@ -69,4 +72,23 @@ module.exports = function (cli, options) {
6972
.action((dir = '.') => {
7073
wrapCommand(eject)(path.resolve(dir))
7174
})
75+
76+
cli
77+
.command('info', 'Shows debugging information about the local environment')
78+
.action(() => {
79+
console.log(chalk.bold('\nEnvironment Info:'))
80+
envinfo.run(
81+
{
82+
System: ['OS', 'CPU'],
83+
Binaries: ['Node', 'Yarn', 'npm'],
84+
Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'],
85+
npmPackages: ['/**/{@vuepress/*/}']
86+
},
87+
{
88+
showNotFound: true,
89+
duplicates: true,
90+
fullTree: true
91+
}
92+
).then(console.log)
93+
})
7294
}

packages/vuepress/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"dependencies": {
3232
"@vuepress/core": "^1.0.0-alpha.47",
3333
"@vuepress/theme-default": "^1.0.0-alpha.47",
34-
"cac": "^6.3.9"
34+
"cac": "^6.3.9",
35+
"envinfo": "^7.2.0"
3536
},
3637
"engines": {
3738
"node": ">=8.6"

0 commit comments

Comments
 (0)