From 0de54b163ada0d133b1ccd8061c10328d5e3ebd7 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Thu, 8 Jun 2023 13:47:01 -0400 Subject: [PATCH] smarter exit --- package-lock.json | 1 - package.json | 1 - scripts/build.js | 15 ++------------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index b30e6af1..b45c7a32 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,6 @@ "cem-plugin-vs-code-custom-data-generator": "^1.4.1", "chalk": "^5.2.0", "change-case": "^4.1.2", - "chokidar": "^3.5.3", "command-line-args": "^5.2.1", "comment-parser": "^1.3.1", "cspell": "^6.18.1", diff --git a/package.json b/package.json index 7a7814ca..bbcebe6c 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,6 @@ "cem-plugin-vs-code-custom-data-generator": "^1.4.1", "chalk": "^5.2.0", "change-case": "^4.1.2", - "chokidar": "^3.5.3", "command-line-args": "^5.2.1", "comment-parser": "^1.3.1", "cspell": "^6.18.1", diff --git a/scripts/build.js b/scripts/build.js index d22716c7..b829926b 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -3,7 +3,6 @@ import { exec, spawn } from 'child_process'; import { globby } from 'globby'; import browserSync from 'browser-sync'; import chalk from 'chalk'; -import chokidar from 'chokidar'; import commandLineArgs from 'command-line-args'; import copy from 'recursive-copy'; import esbuild from 'esbuild'; @@ -32,7 +31,6 @@ let buildResult; async function buildTheDocs(watch = false) { return new Promise((resolve, reject) => { const args = ['@11ty/eleventy', '--quiet']; - const watcher = chokidar.watch(sitedir, { persistent: true }); const output = []; if (watch) { @@ -50,15 +48,8 @@ async function buildTheDocs(watch = false) { output.push(data.toString()); }); - // Spin up Eleventy and wait for the search index to appear before proceeding. The search index is generated during - // eleventy.after, so it appears only after the docs are fully published. This is a hacky way to detect when the - // initial publish is complete, but here we are. - watcher.on('add', async filename => { - if (filename.endsWith('search.json')) { - await watcher.close(); - - resolve({ child, output }); - } + child.on('close', () => { + resolve({ child, output }); }); }); } @@ -273,8 +264,6 @@ if (!serve) { if (result.output.length > 0) { console.log('\n' + result.output.join('\n')); } - - process.exit(); } // Cleanup on exit