From 37b69b43ff513ef942a42ddfba7b0d45422cfa9c Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 14 Jun 2018 09:15:31 -0400 Subject: [PATCH] fix watch by not restarting anymore and enable config for contracts --- lib/core/engine.js | 3 --- lib/pipeline/watch.js | 11 +++++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/core/engine.js b/lib/core/engine.js index f0d8fb087..68e1b7314 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -108,9 +108,6 @@ class Engine { this.events.on('code-generator-ready', function () { self.events.request('code', function (abi, contractsJSON) { pipeline.build(abi, contractsJSON, null, () => { - if (self.watch) { - self.watch.restart(); // Necessary because changing a file while it is writing can stop it from being watched - } self.events.emit('outputDone'); }); }); diff --git a/lib/pipeline/watch.js b/lib/pipeline/watch.js index a2746716e..e670f2900 100644 --- a/lib/pipeline/watch.js +++ b/lib/pipeline/watch.js @@ -27,7 +27,7 @@ class Watch { self.logger.trace('ready to watch contract changes'); }); - this.watchConfigs(function () { + this.watchConfigs(embarkConfig, function () { self.logger.trace('ready to watch config changes'); }); @@ -45,7 +45,6 @@ class Watch { if (fileWatcher.isReady) fileWatcher.close(); fileWatcher.shouldClose = true; }); - this.fileWatchers = []; } watchAssets(embarkConfig, callback) { @@ -98,10 +97,14 @@ class Watch { ); } - watchConfigs(callback) { + watchConfigs(embarkConfig, callback) { let self = this; + let configFolder = embarkConfig.config.replace(/\\/g, '/'); + if (configFolder.charAt(configFolder.length - 1) !== '/') { + configFolder += '/'; + } this.watchFiles( - "config/**/contracts.json", + [`${configFolder}**/contracts.json`, `${configFolder}**/contracts.js`], function (eventName, path) { self.logger.info(`${eventName}: ${path}`); self.events.emit('file-' + eventName, 'config', path);