diff --git a/lib/core/engine.js b/lib/core/engine.js index f0d8fb08..68e1b731 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 a2746716..e670f290 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);