mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
parent
fc259cf985
commit
2d510d640a
11
bin/next-dev
11
bin/next-dev
|
@ -12,12 +12,12 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||||
const argv = parseArgs(process.argv.slice(2), {
|
const argv = parseArgs(process.argv.slice(2), {
|
||||||
alias: {
|
alias: {
|
||||||
h: 'help',
|
h: 'help',
|
||||||
|
H: 'hostname',
|
||||||
p: 'port'
|
p: 'port'
|
||||||
},
|
},
|
||||||
boolean: ['h'],
|
boolean: ['h'],
|
||||||
default: {
|
string: ['H'],
|
||||||
p: 3000
|
default: { p: 3000 }
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if (argv.help) {
|
if (argv.help) {
|
||||||
|
@ -35,6 +35,7 @@ if (argv.help) {
|
||||||
|
|
||||||
Options
|
Options
|
||||||
--port, -p A port number on which to start the application
|
--port, -p A port number on which to start the application
|
||||||
|
--hostname, -H Hostname on which to start the application
|
||||||
--help, -h Displays this message
|
--help, -h Displays this message
|
||||||
`)
|
`)
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
|
@ -56,10 +57,10 @@ if (!existsSync(join(dir, 'pages'))) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const srv = new Server({ dir, dev: true })
|
const srv = new Server({ dir, dev: true })
|
||||||
srv.start(argv.port)
|
srv.start(argv.port, argv.hostname)
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
if (!process.env.NOW) {
|
if (!process.env.NOW) {
|
||||||
console.log(`> Ready on http://localhost:${argv.port}`)
|
console.log(`> Ready on http://${argv.hostname ? argv.hostname : 'localhost'}:${argv.port}`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
Loading…
Reference in a new issue