watch ignores resolved to plugins internals (#48629)

This commit is contained in:
Mikhail Shustov 2019-10-26 02:06:50 +02:00 committed by GitHub
parent e7d82f29d9
commit 11d3445b5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -113,7 +113,7 @@ export default class ClusterManager {
...scanDirs,
];
const extraIgnores = scanDirs
const pluginInternalDirsIgnore = scanDirs
.map(scanDir => resolve(scanDir, '*'))
.concat(pluginPaths)
.reduce(
@ -124,16 +124,11 @@ export default class ClusterManager {
resolve(path, 'target'),
resolve(path, 'scripts'),
resolve(path, 'docs'),
resolve(path, 'src/legacy/server/sass/__tmp__'),
resolve(path, 'legacy/plugins/reporting/.chromium'),
resolve(path, 'legacy/plugins/siem/cypress'),
resolve(path, 'legacy/plugins/apm/cypress'),
resolve(path, 'x-pack/legacy/plugins/canvas/canvas_plugin_src') // prevents server from restarting twice for Canvas plugin changes
),
[]
);
this.setupWatching(extraPaths, extraIgnores);
this.setupWatching(extraPaths, pluginInternalDirsIgnore);
} else this.startCluster();
}
@ -170,7 +165,7 @@ export default class ClusterManager {
.then(() => opn(openUrl));
}
setupWatching(extraPaths, extraIgnores) {
setupWatching(extraPaths, pluginInternalDirsIgnore) {
const chokidar = require('chokidar');
const { fromRoot } = require('../../legacy/utils');
@ -187,12 +182,21 @@ export default class ClusterManager {
...extraPaths,
].map(path => resolve(path));
const ignorePaths = [
fromRoot('src/legacy/server/sass/__tmp__'),
fromRoot('x-pack/legacy/plugins/reporting/.chromium'),
fromRoot('x-pack/legacy/plugins/siem/cypress'),
fromRoot('x-pack/legacy/plugins/apm/cypress'),
fromRoot('x-pack/legacy/plugins/canvas/canvas_plugin_src') // prevents server from restarting twice for Canvas plugin changes
];
this.watcher = chokidar.watch(uniq(watchPaths), {
cwd: fromRoot('.'),
ignored: [
/[\\\/](\..*|node_modules|bower_components|public|__[a-z0-9_]+__|coverage)[\\\/]/,
/\.test\.(js|ts)$/,
...extraIgnores,
...pluginInternalDirsIgnore,
...ignorePaths,
'plugins/java_languageserver'
],
});