From 72942a3777771248a8cf8ac1c51042ed5fb324ea Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 30 Sep 2020 08:37:53 -0700 Subject: [PATCH] [dev/cli] ensure plugins/ and all watch source dirs exist --- plugins/.empty | 0 src/cli/cluster/cluster_manager.ts | 9 +++++++++ 2 files changed, 9 insertions(+) create mode 100644 plugins/.empty diff --git a/plugins/.empty b/plugins/.empty new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/src/cli/cluster/cluster_manager.ts b/src/cli/cluster/cluster_manager.ts index e1f56a2f267fa..3d81185e8a313 100644 --- a/src/cli/cluster/cluster_manager.ts +++ b/src/cli/cluster/cluster_manager.ts @@ -19,6 +19,7 @@ import { resolve } from 'path'; import { format as formatUrl } from 'url'; +import Fs from 'fs'; import opn from 'opn'; import { REPO_ROOT } from '@kbn/utils'; @@ -233,6 +234,14 @@ export class ClusterManager { ) ); + for (const watchPath of watchPaths) { + if (!Fs.existsSync(fromRoot(watchPath))) { + throw new Error( + `A watch directory [${watchPath}] does not exist, which will cause chokidar to fail. Either make sure the directory exists or remove it as a watch source in the ClusterManger` + ); + } + } + const ignorePaths = [ /[\\\/](\..*|node_modules|bower_components|target|public|__[a-z0-9_]+__|coverage)([\\\/]|$)/, /\.test\.(js|tsx?)$/,