提交 3eeb080e 编写于 作者: J James George 提交者: ULIVZ

feat($core): info command (#1573)

上级 3c560d12
......@@ -46,6 +46,10 @@ do not clear screen when dev server is ready.
Copy the default theme into `.vuepress/theme` for customization.
## info
Shows debugging information about the local environment.
## more commands
You can create a custom command with [extendCli](../plugin/option-api.md#extendcli).
......@@ -4,6 +4,9 @@
* Module dependencies.
*/
const { chalk } = require('@vuepress/shared-utils')
const envinfo = require('envinfo')
const { dev, build, eject } = require('@vuepress/core')
const { path, logger, env } = require('@vuepress/shared-utils')
const { wrapCommand } = require('./util')
......@@ -69,4 +72,23 @@ module.exports = function (cli, options) {
.action((dir = '.') => {
wrapCommand(eject)(path.resolve(dir))
})
cli
.command('info', '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: ['/**/{@vuepress/*/}']
},
{
showNotFound: true,
duplicates: true,
fullTree: true
}
).then(console.log)
})
}
......@@ -31,7 +31,8 @@
"dependencies": {
"@vuepress/core": "^1.0.0-alpha.47",
"@vuepress/theme-default": "^1.0.0-alpha.47",
"cac": "^6.3.9"
"cac": "^6.3.9",
"envinfo": "^7.2.0"
},
"engines": {
"node": ">=8.6"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册