fix watch for simple apps

This commit is contained in:
Jonathan Rainville 2018-06-15 15:50:23 -04:00
parent 6ea395ca76
commit 2996f51314
1 changed files with 10 additions and 5 deletions

View File

@ -99,12 +99,17 @@ class Watch {
watchConfigs(embarkConfig, callback) {
let self = this;
let configFolder = embarkConfig.config.replace(/\\/g, '/');
if (configFolder.charAt(configFolder.length - 1) !== '/') {
configFolder += '/';
let contractsConfig;
if (typeof embarkConfig.config === 'object' || embarkConfig.config.contracts) {
contractsConfig = embarkConfig.config.contracts;
} else {
let contractsFolder = embarkConfig.config.replace(/\\/g, '/');
if (contractsFolder.charAt(contractsFolder.length - 1) !== '/') {
contractsFolder += '/';
}
contractsConfig = [`${contractsFolder}**/contracts.json`, `${contractsFolder}**/contracts.js`]
}
this.watchFiles(
[`${configFolder}**/contracts.json`, `${configFolder}**/contracts.js`],
this.watchFiles(contractsConfig,
function (eventName, path) {
self.logger.info(`${eventName}: ${path}`);
self.events.emit('file-' + eventName, 'config', path);