From 07e58bcd040ef97bab7120f2b9b610c1a1f2b8ff Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 1 Jun 2018 13:19:48 -0400 Subject: [PATCH] check window size in dashboard instead of index --- lib/dashboard/dashboard.js | 12 ++++++++++++ lib/index.js | 6 ------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/dashboard/dashboard.js b/lib/dashboard/dashboard.js index 029b14e85..641c672be 100644 --- a/lib/dashboard/dashboard.js +++ b/lib/dashboard/dashboard.js @@ -1,16 +1,28 @@ let async = require('async'); +let windowSize = require('window-size'); let Monitor = require('./monitor.js'); let Console = require('./console.js'); class Dashboard { constructor(options) { + const self = this; this.logger = options.logger; this.events = options.events; this.plugins = options.plugins; this.version = options.version; this.env = options.env; this.contractsConfig = options.contractsConfig; + + this.events.on('firstDeploymentDone', this.checkWindowSize.bind(this)); + this.events.on('outputDone', this.checkWindowSize.bind(this)); + } + + checkWindowSize() { + let size = windowSize.get(); + if (size.height < 40 || size.width < 118) { + this.logger.warn(__("tip: you can resize the terminal or disable the dashboard with") + " embark run --nodashboard".bold.underline); + } } start(done) { diff --git a/lib/index.js b/lib/index.js index ca034230b..9e3c3c511 100644 --- a/lib/index.js +++ b/lib/index.js @@ -68,7 +68,6 @@ class Embark { let self = this; self.context = options.context || [constants.contexts.run, constants.contexts.build]; let Dashboard = require('./dashboard/dashboard.js'); - let windowSize = require('window-size'); let engine = new Engine({ env: options.env, @@ -153,11 +152,6 @@ class Embark { engine.logger.info(err.stack); } else { engine.events.emit('firstDeploymentDone'); - - let size = windowSize.get(); - if (size.height < 40 || size.width < 118) { - engine.logger.warn(__("tip: you can resize the terminal or disable the dashboard with") + " embark run --nodashboard".bold.underline); - } } }); }