[dev/server] ignore irrelevant changes in plugins (#11884)

* [dev/server] ignore changes in test,build,scripts,docs dirs at root of plugins

* [dev/clusterManager] unwrap extra ignore paths
This commit is contained in:
Spencer 2017-05-18 19:31:38 -07:00 committed by GitHub
parent 1d2341fc2b
commit c2ccab8515

View file

@ -62,10 +62,23 @@ module.exports = class ClusterManager {
bindAll(this, 'onWatcherAdd', 'onWatcherError', 'onWatcherChange');
if (opts.watch) {
this.setupWatching([
const extraPaths = [
...settings.plugins.paths,
...settings.plugins.scanDirs
]);
...settings.plugins.scanDirs,
];
const extraIgnores = settings.plugins.scanDirs
.map(scanDir => resolve(scanDir, '*'))
.concat(settings.plugins.paths)
.reduce((acc, path) => acc.concat(
resolve(path, 'test'),
resolve(path, 'build'),
resolve(path, 'target'),
resolve(path, 'scripts'),
resolve(path, 'docs'),
), []);
this.setupWatching(extraPaths, extraIgnores);
}
else this.startCluster();
@ -79,7 +92,7 @@ module.exports = class ClusterManager {
}
}
setupWatching(extraPaths) {
setupWatching(extraPaths, extraIgnores) {
const chokidar = require('chokidar');
const { fromRoot } = require('../../utils');
@ -94,7 +107,10 @@ module.exports = class ClusterManager {
this.watcher = chokidar.watch(uniq(watchPaths), {
cwd: fromRoot('.'),
ignored: /[\\\/](\..*|node_modules|bower_components|public|__tests__|coverage)[\\\/]/
ignored: [
/[\\\/](\..*|node_modules|bower_components|public|__tests__|coverage)[\\\/]/,
...extraIgnores
]
});
this.watcher.on('add', this.onWatcherAdd);