mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-11 06:25:57 +00:00
open default browser when webserver has started
This commit is contained in:
parent
f778dad589
commit
72943dc0e5
@ -3,6 +3,7 @@ const fs = require('../../core/fs.js');
|
||||
let http = require('http');
|
||||
let serveStatic = require('serve-static');
|
||||
const {canonicalHost, defaultHost, dockerHostSwap} = require('../../utils/host');
|
||||
const opn = require('opn');
|
||||
const utils = require('../../utils/utils.js');
|
||||
require('http-shutdown').extend();
|
||||
|
||||
@ -10,6 +11,8 @@ require('ejs');
|
||||
const embark_building_placeholder = require('../code_generator/code_templates/embark-building-placeholder.html.ejs');
|
||||
|
||||
let isFirstStart = true;
|
||||
let opened = false;
|
||||
|
||||
class Server {
|
||||
constructor(options) {
|
||||
this.dist = options.dist || 'dist/';
|
||||
@ -43,6 +46,10 @@ class Server {
|
||||
" " +
|
||||
("http://" + canonicalHost(this.hostname) +
|
||||
":" + this.port).bold.underline.green, this.port);
|
||||
if (!opened) {
|
||||
opn(`http://${canonicalHost(this.hostname)}:${this.port}`);
|
||||
opened = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user