[clusterManager] watch the plugin paths for changes

This commit is contained in:
spalger 2016-02-10 07:34:07 -07:00
parent 4a2df47509
commit 1606a1f748

View file

@ -63,7 +63,13 @@ module.exports = class ClusterManager {
bindAll(this, 'onWatcherAdd', 'onWatcherError', 'onWatcherChange');
if (opts.watch) this.setupWatching();
if (opts.watch) {
this.setupWatching([
...settings.plugins.paths,
...settings.plugins.scanDirs
]);
}
else this.startCluster();
}
@ -75,7 +81,7 @@ module.exports = class ClusterManager {
}
}
setupWatching() {
setupWatching(extraPaths) {
const chokidar = require('chokidar');
const utils = require('requirefrom')('src/utils');
const fromRoot = utils('fromRoot');
@ -86,7 +92,7 @@ module.exports = class ClusterManager {
'src/ui',
'src/utils',
'config',
'installedPlugins'
...extraPaths
], {
cwd: fromRoot('.'),
ignored: /[\\\/](\..*|node_modules|bower_components|public|__tests__)[\\\/]/