mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
feat(bin): adds version flag
adds --version / -v support for the nuxt binary; will always output version and exit(0)
This commit is contained in:
parent
cf693d04a3
commit
a5e16d2fe6
14
bin/nuxt-dev
14
bin/nuxt-dev
@ -10,7 +10,9 @@ const fs = require('fs')
|
||||
const parseArgs = require('minimist')
|
||||
const { Nuxt, Builder } = require('../')
|
||||
const chokidar = require('chokidar')
|
||||
const resolve = require('path').resolve
|
||||
const path = require('path')
|
||||
const resolve = path.resolve
|
||||
const pkg = require(path.join('..','package.json'))
|
||||
|
||||
const argv = parseArgs(process.argv.slice(2), {
|
||||
alias: {
|
||||
@ -19,15 +21,21 @@ const argv = parseArgs(process.argv.slice(2), {
|
||||
p: 'port',
|
||||
c: 'config-file',
|
||||
s: 'spa',
|
||||
u: 'universal'
|
||||
u: 'universal',
|
||||
v: 'version'
|
||||
},
|
||||
boolean: ['h', 's', 'u'],
|
||||
boolean: ['h', 's', 'u', 'v'],
|
||||
string: ['H', 'c'],
|
||||
default: {
|
||||
c: 'nuxt.config.js'
|
||||
}
|
||||
})
|
||||
|
||||
if(argv.version){
|
||||
console.log(pkg.version)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
if (argv.hostname === '') {
|
||||
console.error(`> Provided hostname argument has no value`)
|
||||
process.exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user