More work on fixing Docker build

This commit is contained in:
Jesse Wierzbinski 2024-04-06 22:56:15 -10:00
parent 015177e3a2
commit ea1d7b1510
No known key found for this signature in database
9 changed files with 163 additions and 145 deletions

View file

@ -2,5 +2,9 @@
"name": "config-manager",
"version": "0.0.0",
"main": "index.ts",
"dependencies": { "@iarna/toml": "^2.2.5", "merge-deep-ts": "^1.2.6" }
"dependencies": {
"@iarna/toml": "^2.2.5",
"c12": "^1.10.0",
"merge-deep-ts": "^1.2.6"
}
}

View file

@ -1,4 +1,5 @@
import { appendFile } from "node:fs/promises";
import { appendFile, writeFile, mkdir, exists } from "node:fs/promises";
import { dirname } from "node:path";
import type { BunFile } from "bun";
export enum LogLevel {
@ -44,11 +45,17 @@ export class LogManager {
if (this.output === Bun.stdout) {
await Bun.write(Bun.stdout, `${text}\n`);
} else {
if (!(await this.output.exists())) {
if (!(await exists(this.output.name ?? ""))) {
// Create file if it doesn't exist
await Bun.write(this.output, "", {
createPath: true,
});
try {
await mkdir(dirname(this.output.name ?? ""), {
recursive: true,
});
await writeFile(this.output.name ?? "", "");
this.output = Bun.file(this.output.name ?? "");
} catch {
//
}
}
await appendFile(this.output.name ?? "", `${text}\n`);
}