Merge pull request #4856 from thelounge/generateConfigDoc

fix generate-config-doc.js
This commit is contained in:
Max Leiter 2024-04-07 19:38:13 -07:00 committed by GitHub
commit 549c445853
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();
}