Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit

Permalink
feat(chore): included a dedicated option to show up envinfo (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 authored and clarkdo committed Jul 1, 2019
1 parent 5738186 commit d2917a9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,36 @@ const path = require('path')
const sao = require('sao')
const cac = require('cac')
const chalk = require('chalk')
const envinfo = require('envinfo')
const { version } = require('./package.json')

const generator = path.resolve(__dirname, './')

const cli = cac('create-nuxt-app')

const showEnvInfo = async () => {
console.log(chalk.bold('\nEnvironment Info:'))
const result = await envinfo
.run({
System: ['OS', 'CPU'],
Binaries: ['Node', 'Yarn', 'npm'],
Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'],
npmGlobalPackages: ['nuxt', 'create-nuxt-app']
})
console.log(result)
process.exit(1)
}

cli
.command('[out-dir] [options]', 'Generate in a custom directory or current directory')
.option('--edge', 'To install `nuxt-edge` instead of `nuxt`')
.option('--info', 'Print out debugging information relating to the local environment')
.action((outDir = '.') => {
const hasInfoArg = process.argv.slice(2)[0] === '--info'
if (hasInfoArg) {
return showEnvInfo()
}
console.log()
console.log(chalk`{cyan create-nuxt-app v${version}}`)
console.log(chalk`✨ Generating Nuxt.js project in {cyan ${outDir}}`)

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"cac": "^6.5.2",
"chalk": "^2.4.2",
"cross-spawn": "^6.0.5",
"envinfo": "^7.3.1",
"glob": "^7.1.3",
"lodash": "^4.17.11",
"sao": "^1.6.1",
Expand Down

0 comments on commit d2917a9

Please sign in to comment.