refactor(server/utils): isDev move to utils and replace fn with boolean

this value cannot change during runtime,
=> there is no need to have these checks
as dynamic function, instead just
export the boolean value directly
This commit is contained in:
Panagiotis Papadopoulos
2025-01-22 19:08:38 +01:00
parent ca2bb94200
commit 31c46753de
9 changed files with 18 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
import { WebSocketServer as WebSocketServer, WebSocket } from "ws";
import { isElectron, randomString } from "./utils.js";
import { isDev, isElectron, randomString } from "./utils.js";
import log from "./log.js";
import sql from "./sql.js";
import cls from "./cls.js";
@@ -9,11 +9,10 @@ import protectedSessionService from "./protected_session.js";
import becca from "../becca/becca.js";
import AbstractBeccaEntity from "../becca/entities/abstract_becca_entity.js";
import env from "./env.js";
import type { IncomingMessage, Server as HttpServer } from "http";
import type { EntityChange } from "./entity_changes_interface.js";
if (env.isDev()) {
if (isDev) {
const chokidar = (await import("chokidar")).default;
const debounce = (await import("debounce")).default;
const debouncedReloadFrontend = debounce(() => reloadFrontend("source code change"), 200);