Skip to content

Commit

Permalink
Don't only watch on the first file request
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmengels committed May 4, 2024
1 parent c33a954 commit 5ce08f9
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function watchFiles(
elmJsonWatcher.close(),
readmeWatcher.close(),
fileWatcher.close(),
extraFilesWatcher.close(),
extraFilesWatchers.forEach(watcher => watcher.close()),
suppressedErrorsWatcher.close(),
configurationWatcher && configurationWatcher.close()
]);
Expand Down Expand Up @@ -128,13 +128,13 @@ function watchFiles(
sourceDirectories
);

const extraFilesWatcher = createExtraFilesWatcher(
const extraFilesWatchers = requestedExtraFiles.map(request => createExtraFilesWatcher(
options,
app,
runReview,
onError,
requestedExtraFiles
);
request
));

const suppressedErrorsWatcher = createSuppressedFilesWatcher(
options,
Expand All @@ -154,7 +154,7 @@ function watchFiles(
elmJsonWatcher.close(),
readmeWatcher.close(),
fileWatcher.close(),
extraFilesWatcher.close(),
extraFilesWatchers.forEach((watcher) => watcher.close()),
suppressedErrorsWatcher.close()
]);

Expand Down Expand Up @@ -376,17 +376,16 @@ function createFileWatcher(
* @param {App} app
* @param {() => void} runReview
* @param {(err: Error) => void} onError
* @param {ExtraFileRequest[]} extraFileRequests
* @param {ExtraFileRequest} request
* @return {FSWatcher}
*/
function createExtraFilesWatcher(
options,
app,
runReview,
onError,
extraFileRequests
request
) {
const request = extraFileRequests[0];
return chokidar
.watch(
request.files.map(
Expand Down

0 comments on commit 5ce08f9

Please sign in to comment.