This commit is contained in:
Rizky 2024-06-21 04:59:04 +07:00
parent 40df47cd2d
commit 3bd3ee0429
2 changed files with 24 additions and 19 deletions

View File

@ -7,6 +7,7 @@ type SingleExport = {
val: string; val: string;
}; };
export const parseTypeDef = async (path: string) => { export const parseTypeDef = async (path: string) => {
console.log("parsing", path);
const ast = await parseFile(path, { syntax: "typescript" }); const ast = await parseFile(path, { syntax: "typescript" });
const exports = {} as Record<string, SingleExport[]>; const exports = {} as Record<string, SingleExport[]>;

View File

@ -94,9 +94,12 @@ export const initTypings = async (
} }
} }
try {
const res = JSON.stringify(await parseTypeDef(path)); const res = JSON.stringify(await parseTypeDef(path));
await Bun.write( await Bun.write(
dir.data(`/code/${id_site}/site/type_def.${file.lastModified}.json`), dir.data(
`/code/${id_site}/site/type_def.${file.lastModified}.json`
),
res res
); );
@ -115,6 +118,7 @@ export const initTypings = async (
data: { ts: now, mode: "typings" }, data: { ts: now, mode: "typings" },
}); });
}); });
} catch (e) {}
}, 180); }, 180);
}); });
} catch (e) { } catch (e) {