Skip to content

Commit 2f6ee68

Browse files
New info command
Shows up useful information regarding the local environment
1 parent 41b5cfb commit 2f6ee68

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

packages/vuepress/lib/registerCoreCommands.js

Lines changed: 22 additions & 0 deletions
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 useful information regarding 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+
npmGlobalPackages: ['@vuepress']
86+
},
87+
{
88+
showNotFound: true,
89+
duplicates: true,
90+
fullTree: true
91+
}
92+
).then(console.log)
93+
})
7294
}

packages/vuepress/package.json

Lines changed: 2 additions & 1 deletion
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)