From df508e4e8d9772dcd5b7adf760b538810fa28ae6 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 23 Sep 2016 02:45:21 -0700 Subject: [PATCH] watch for config file changes and redeploy --- lib/watch.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/watch.js b/lib/watch.js index b9564fb8..c3bcc21a 100644 --- a/lib/watch.js +++ b/lib/watch.js @@ -55,6 +55,25 @@ Watch.prototype.start = function() { .on('unlink', path => this.logger.info(`File ${path} has been removed`)) .on('ready', () => this.logger.info('ready to watch changes')); + + var configWatcher = chokidar.watch("config/**/contracts.json", { + ignored: /[\/\\]\./, persistent: true, ignoreInitial: true, followSymlinks: true + }); + configWatcher + .on('add', path => { + this.logger.info(`File ${path} has been added`) + this.trigger('redeploy', path); + }) + .on('change', path => { + this.logger.info(`File ${path} has been changed`) + this.trigger('redeploy', path); + }) + .on('unlink', path => { + this.logger.info(`File ${path} has been removed`) + this.trigger('redeploy', path); + }) + .on('ready', () => this.logger.info('ready to watch changes')); + this.logger.info("done!"); };