chore: use chokidar for configWatcherService (#2315)
It's just a lot snappier + works flawlessly under Bun. Reviewed-on: #2315 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
764cdd1ab8
commit
4f1f9592b0
4
package-lock.json
generated
4
package-lock.json
generated
@ -14,6 +14,7 @@
|
||||
"@types/websocket": "^1.0.10",
|
||||
"@types/ws": "^8.18.1",
|
||||
"@typescript/native-preview": "^7.0.0-dev.20250625.1",
|
||||
"chokidar": "^4.0.3",
|
||||
"crc-32": "^1.2.2",
|
||||
"express": "^5",
|
||||
"json-with-bigint": "^3.4.4",
|
||||
@ -31,7 +32,6 @@
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
||||
"@typescript-eslint/parser": "^8.28.0",
|
||||
"chokidar": "^4.0.3",
|
||||
"eslint": "^8",
|
||||
"eslint-plugin-prettier": "^5.2.5",
|
||||
"prettier": "^3.5.3",
|
||||
@ -997,7 +997,6 @@
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
|
||||
"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"readdirp": "^4.0.1"
|
||||
@ -2803,7 +2802,6 @@
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
|
||||
"integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 14.18.0"
|
||||
|
@ -28,6 +28,7 @@
|
||||
"@types/websocket": "^1.0.10",
|
||||
"@types/ws": "^8.18.1",
|
||||
"@typescript/native-preview": "^7.0.0-dev.20250625.1",
|
||||
"chokidar": "^4.0.3",
|
||||
"crc-32": "^1.2.2",
|
||||
"express": "^5",
|
||||
"json-with-bigint": "^3.4.4",
|
||||
@ -45,7 +46,6 @@
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
||||
"@typescript-eslint/parser": "^8.28.0",
|
||||
"chokidar": "^4.0.3",
|
||||
"eslint": "^8",
|
||||
"eslint-plugin-prettier": "^5.2.5",
|
||||
"prettier": "^3.5.3",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import fs from "fs";
|
||||
import chokidar from "chokidar";
|
||||
import fsPromises from "fs/promises";
|
||||
import { logger } from "../utils/logger";
|
||||
import { config, configPath, loadConfig } from "./configService";
|
||||
@ -6,12 +6,7 @@ import { getWebPorts, sendWsBroadcast, startWebServer, stopWebServer } from "./w
|
||||
import { Inbox } from "../models/inboxModel";
|
||||
|
||||
let amnesia = false;
|
||||
fs.watchFile(configPath, (now, then) => {
|
||||
// https://github.com/oven-sh/bun/issues/20542
|
||||
if (process.versions.bun && now.mtimeMs == then.mtimeMs) {
|
||||
return;
|
||||
}
|
||||
|
||||
chokidar.watch(configPath).on("change", () => {
|
||||
if (amnesia) {
|
||||
amnesia = false;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user