mirror of
https://github.com/c8r/x0.git
synced 2024-11-09 21:15:22 +03:00
Merge pull request #24 from mike3run/master
open in browser but only once
This commit is contained in:
commit
bd4e0907d6
@ -2,7 +2,7 @@
|
||||
const path = require('path')
|
||||
const meow = require('meow')
|
||||
const { pkg } = require('read-pkg-up').sync()
|
||||
const open = require('opn')
|
||||
const openBrowser = require('react-dev-utils/openBrowser')
|
||||
const ora = require('ora')
|
||||
const chalk = require('chalk')
|
||||
|
||||
@ -57,15 +57,13 @@ const spinner = ora().start()
|
||||
switch (cmd) {
|
||||
case 'dev':
|
||||
spinner.start('starting dev server')
|
||||
let opened = false
|
||||
const dev = require('../lib/dev')
|
||||
dev(filename, options)
|
||||
.then(server => {
|
||||
const { port } = server.listeningApp.address()
|
||||
spinner.succeed(`dev server listening at http://localhost:${port}`)
|
||||
if (!opened && options.open) {
|
||||
open(`http://localhost:${port}`)
|
||||
opened = true
|
||||
if (options.open) {
|
||||
openBrowser(`http://localhost:${port}`)
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
|
@ -30,10 +30,10 @@
|
||||
"glamor": "^2.20.40",
|
||||
"glamorous": "^4.11.0",
|
||||
"meow": "^3.7.0",
|
||||
"opn": "^5.1.0",
|
||||
"ora": "^1.3.0",
|
||||
"pkg-up": "^2.0.0",
|
||||
"react": "^16.2.0",
|
||||
"react-dev-utils": "^4.2.1",
|
||||
"react-dom": "^16.2.0",
|
||||
"react-fela": "^6.1.1",
|
||||
"read-pkg-up": "^2.0.0",
|
||||
|
Loading…
Reference in New Issue
Block a user