🎨 Move opener to the watcher class
This commit is contained in:
+1
-26
@@ -6,7 +6,6 @@ const Projects = require('./projects.js')
|
||||
const socketIo = require('socket.io')
|
||||
const util = require('util')
|
||||
const colors = require('colors')
|
||||
const opener = require('opener')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const packageJson = require('../package.json')
|
||||
@@ -34,12 +33,6 @@ class App
|
||||
this.setServer()
|
||||
}
|
||||
|
||||
// If host is specified, show URL open in browser
|
||||
if(this.config.host)
|
||||
{
|
||||
this.showUrlAndOpen()
|
||||
}
|
||||
|
||||
// If not started as a server
|
||||
// Start watching files
|
||||
if(!this.config.server)
|
||||
@@ -239,11 +232,7 @@ class App
|
||||
console.log(util.inspect(project.files.describe(), { depth: null, colors: true }))
|
||||
}
|
||||
|
||||
// If not server, show URL open in browser
|
||||
if(!this.config.server)
|
||||
{
|
||||
this.showUrlAndOpen()
|
||||
}
|
||||
socket.emit('started')
|
||||
})
|
||||
|
||||
// Update file
|
||||
@@ -327,20 +316,6 @@ class App
|
||||
{
|
||||
this.watcher = new Watcher(this.config)
|
||||
}
|
||||
|
||||
/**
|
||||
* Show URL and open it if should
|
||||
*/
|
||||
showUrlAndOpen()
|
||||
{
|
||||
const url = this.config.domain
|
||||
console.log('app'.green.bold + ' - ' + url.yellow)
|
||||
|
||||
if(this.config.open)
|
||||
{
|
||||
opener(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = App
|
||||
|
||||
Reference in New Issue
Block a user