mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
feat(nuxi): support --host
, --ssl-cert
, and --ssl-key
args (#993)
This commit is contained in:
parent
b2c74d739f
commit
0b45721b8e
@ -12,16 +12,25 @@ import { defineNuxtCommand } from './index'
|
||||
export default defineNuxtCommand({
|
||||
meta: {
|
||||
name: 'dev',
|
||||
usage: 'npx nuxi dev [rootDir] [--clipboard] [--open, -o]',
|
||||
usage: 'npx nuxi dev [rootDir] [--clipboard] [--open, -o] [--port, -p] [--host, -h] [--ssl-cert] [--ssl-key]',
|
||||
description: 'Run nuxt development server'
|
||||
},
|
||||
async invoke (args) {
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||
const https = !!(args['ssl-cert'] && args['ssl-key'])
|
||||
const server = createServer()
|
||||
const listener = await server.listen({
|
||||
clipboard: args.clipboard,
|
||||
open: args.open || args.o,
|
||||
port: args.port || args.p
|
||||
port: args.port || args.p,
|
||||
hostname: args.host || args.h,
|
||||
...(https && {
|
||||
https,
|
||||
certificate: {
|
||||
cert: args['ssl-cert'],
|
||||
key: args['ssl-key']
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
const rootDir = resolve(args._[0] || '.')
|
||||
|
Loading…
Reference in New Issue
Block a user