chore: initialize bun ts config
This commit is contained in:
commit
25e4dd7714
8 files changed
+447
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { CorpConfig, CorpConfigSchema } from "./types.js";
|
||||
|
||||
const ENTERPRISES_DIR = "enterprises";
|
||||
|
||||
export function loadCorpConfigs(): CorpConfig[] {
|
||||
if (!existsSync(ENTERPRISES_DIR)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return readdirSync(ENTERPRISES_DIR)
|
||||
.filter((file) => file.endsWith(".json"))
|
||||
.filter((file) => !file.startsWith("example."))
|
||||
.map((file) => {
|
||||
const content = readFileSync(join(ENTERPRISES_DIR, file), "utf-8");
|
||||
return CorpConfigSchema.parse(JSON.parse(content));
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user