chore: update optional deps (ws & node-watch)

Updates node-watch dep to ^0.7.1 which is a breaking change in the interface of watch function for compatibility on certain windows systems that don't give event and filename info.

Also updates ws dep to v^7.4.3, minor version and bug fixes.
This commit is contained in:
M. George Hansen 2021-02-28 08:26:02 -08:00
parent b5cc33df0c
commit a611240366
3 changed files with 18 additions and 14 deletions

View file

@ -209,7 +209,7 @@ const startWebSocketServer = async (
const watchFolders = async (
folders: string[],
listener: (eventType: "update" | "remove", fileName: string) => void,
listener: (eventType?: "update" | "remove", fileName?: string) => void,
): Promise<void> => {
// Try to load node-watch, falling back to fs watch if node-watch isn't
// available.
@ -282,7 +282,11 @@ const devCommand: Command = {
existsSync(filePath),
);
await watchFolders(watchedFolders, async (event, filePath) => {
console.log(`${filePath}:${event} triggering rebuild...`);
const filePathForLog = filePath || "<UNKNOWN_FILE>";
const eventForLog = event || "<UNKNOWN_EVENT>";
console.log(
`${filePathForLog}:${eventForLog} triggering rebuild...`,
);
await rebuild();
if (wsServer != null) {
console.log(`rebuild finished, reloading browsers...`);