- Add modular DB layer (adapters, migrations, repos, helpers) - Replace localDb/usageDb/requestDetailsDb monoliths with repos - Add Tailscale tunnel integration & status check API - Add /api/cli-tools/all-statuses aggregated endpoint - Add settingsStore (Zustand) and mitm/dbReader - Add DB unit tests (benchmark, concurrent, migration, vs-lowdb)
21 lines
669 B
JavaScript
21 lines
669 B
JavaScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
let cachedVersion = null;
|
|
|
|
export function getAppVersion() {
|
|
if (cachedVersion) return cachedVersion;
|
|
try {
|
|
const pkgPath = path.join(process.cwd(), "package.json");
|
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
cachedVersion = pkg.version || "0.0.0";
|
|
} catch {
|
|
cachedVersion = "0.0.0";
|
|
}
|
|
return cachedVersion;
|
|
}
|
|
|
|
export function timestampSlug(date = new Date()) {
|
|
const pad = (n) => String(n).padStart(2, "0");
|
|
return `${date.getFullYear()}${pad(date.getMonth() + 1)}${pad(date.getDate())}-${pad(date.getHours())}${pad(date.getMinutes())}${pad(date.getSeconds())}`;
|
|
}
|