From cccea423d92065544e564aa60438cb4d2f30f080 Mon Sep 17 00:00:00 2001 From: "M. George Hansen" Date: Sun, 28 Feb 2021 08:26:02 -0800 Subject: [PATCH] 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. --- package-lock.json | 18 +++++++++--------- package.json | 6 +++--- src/cli/commands/dev.ts | 8 ++++++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 39083e2..f18c269 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,9 +78,9 @@ "dev": true }, "@types/ws": { - "version": "7.2.4", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.2.4.tgz", - "integrity": "sha512-9S6Ask71vujkVyeEXKxjBSUV8ZUB0mjL5la4IncBoheu04bDaYyUKErh1BQcY9+WzOUOiKqz/OnpJHYckbMfNg==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.0.tgz", + "integrity": "sha512-Y29uQ3Uy+58bZrFLhX36hcI3Np37nqWE7ky5tjiDoy1GDZnIwVxS0CgF+s+1bXMzjKBFy+fqaRfb708iNzdinw==", "dev": true, "requires": { "@types/node": "*" @@ -1077,9 +1077,9 @@ "dev": true }, "node-watch": { - "version": "0.6.4", - "resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.6.4.tgz", - "integrity": "sha512-cI6CHzivIFESe8djiK3Wh90CtWQBxLwMem8x8S+2GSvCvFgoMuOKVlfJtQ/2v3Afg3wOnHl/+tXotEs8z5vOrg==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.7.1.tgz", + "integrity": "sha512-UWblPYuZYrkCQCW5PxAwYSxaELNBLUckrTBBk8xr1/bUgyOkYYTsUcV4e3ytcazFEOyiRyiUrsG37pu6I0I05g==", "optional": true }, "object-assign": { @@ -1676,9 +1676,9 @@ } }, "ws": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.0.tgz", - "integrity": "sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w==", + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.3.tgz", + "integrity": "sha512-hr6vCR76GsossIRsr8OLR9acVVm1jyfEWvhbNjtgPOrfvAlKzvyeg/P6r8RuDjRyrcQoPQT7K0DGEPc7Ae6jzA==", "optional": true }, "xregexp": { diff --git a/package.json b/package.json index f8e6116..6123af5 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ }, "devDependencies": { "@types/node": "~10", - "@types/ws": "^7.2.4", + "@types/ws": "^7.4.0", "@typescript-eslint/eslint-plugin": "^3.0.2", "@typescript-eslint/parser": "^3.0.2", "eslint": "^7.1.0", @@ -48,7 +48,7 @@ "typescript": "~3.9.3" }, "optionalDependencies": { - "node-watch": "^0.6.4", - "ws": "^7.3.0" + "node-watch": "^0.7.1", + "ws": "^7.4.3" } } diff --git a/src/cli/commands/dev.ts b/src/cli/commands/dev.ts index 77497ad..d7a13cc 100644 --- a/src/cli/commands/dev.ts +++ b/src/cli/commands/dev.ts @@ -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 => { // 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 || ""; + const eventForLog = event || ""; + console.log( + `${filePathForLog}:${eventForLog} triggering rebuild...`, + ); await rebuild(); if (wsServer != null) { console.log(`rebuild finished, reloading browsers...`);