Commit ff7e128c authored by Luke Edwards's avatar Luke Edwards Committed by Guillermo Rauch

add cli version flags (#435)

* add version flags

* fix typo -.-
parent fce87e6e
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import { join } from 'path' import { join } from 'path'
import { spawn } from 'cross-spawn' import { spawn } from 'cross-spawn'
import { watchFile } from 'fs' import { watchFile } from 'fs'
import pkg from '../../package.json'
const defaultCommand = 'dev' const defaultCommand = 'dev'
const commands = new Set([ const commands = new Set([
...@@ -15,6 +16,11 @@ const commands = new Set([ ...@@ -15,6 +16,11 @@ const commands = new Set([
let cmd = process.argv[2] let cmd = process.argv[2]
let args let args
if (new Set(['--version', '-v']).has(cmd)) {
console.log(`next.js v${pkg.version}`)
process.exit(0)
}
if (new Set(['--help', '-h']).has(cmd)) { if (new Set(['--help', '-h']).has(cmd)) {
console.log(` console.log(`
Usage Usage
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment