precompile

Signed-off-by: Hadi <[email protected]>
This commit is contained in:
Hadi
2026-09-01 10:57:30 +02:00
parent 12305ba1f2
commit 038842878a
46 changed files with 1602 additions and 2 deletions
+22
View File
@@ -0,0 +1,22 @@
// @bun
// src/yaml.ts
import { existsSync, readFileSync } from "fs";
import { homedir } from "os";
import { join } from "path";
import { parse as parseYAML } from "yaml";
function configPath() {
const configDir = process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
return join(configDir, "ilovetui", "config.yaml");
}
function readYamlFile(path) {
if (!existsSync(path))
return;
try {
return parseYAML(readFileSync(path, "utf8")) ?? undefined;
} catch (err) {
console.error(`ilovetui: failed to parse ${path}, ignoring it.`, err);
return;
}
}
export { configPath, readYamlFile };