From 2466c1b1e416a5f949b825b10e47d7f6f5064ff0 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Sun, 7 Apr 2024 16:22:08 +0200 Subject: [PATCH] fix generate-config-doc.js It errored out with > Error: Cannot find module '../server/log' Which is expected, but we don't really need it, we can just open code the log functions --- scripts/generate-config-doc.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/scripts/generate-config-doc.js b/scripts/generate-config-doc.js index 9978ebae..6e7ab44f 100644 --- a/scripts/generate-config-doc.js +++ b/scripts/generate-config-doc.js @@ -10,10 +10,35 @@ const {readFileSync, writeFileSync} = require("fs"); const colors = require("chalk"); -const log = require("../server/log").default; const {join} = require("path"); const {spawnSync} = require("child_process"); +function timestamp() { + const datetime = new Date().toISOString().split(".")[0].replace("T", " "); + + return colors.dim(datetime); +} + +const log = { + /* eslint-disable no-console */ + error(...args) { + console.error(timestamp(), colors.red("[ERROR]"), ...args); + }, + warn(...args) { + console.error(timestamp(), colors.yellow("[WARN]"), ...args); + }, + info(...args) { + console.log(timestamp(), colors.blue("[INFO]"), ...args); + }, + debug(...args) { + console.log(timestamp(), colors.green("[DEBUG]"), ...args); + }, + raw(...args) { + console.log(...args); + }, + /* eslint-enable no-console */ +}; + function getGitUsername() { return spawnSync("git", ["config", "user.name"], {encoding: "utf8"}).stdout.trim(); }