throw error if modules path is unspecified

This commit is contained in:
outfoxxed 2024-10-24 19:14:46 -07:00
parent c8cd2ec70e
commit 3641ce9277
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E

View file

@ -33,6 +33,10 @@ async function readSubdir(subdir: string): Promise<dirData[]> {
export async function generateTypeData(): Promise<RouteData[]> { export async function generateTypeData(): Promise<RouteData[]> {
const mainDir = import.meta.env.SECRET_MODULES_PATH; const mainDir = import.meta.env.SECRET_MODULES_PATH;
if (!mainDir || mainDir == "") {
throw new Error("Cannot generate types, missing SECRET_MODULES_PATH");
}
const subdirs = await fs.readdir(mainDir, { const subdirs = await fs.readdir(mainDir, {
withFileTypes: true, withFileTypes: true,
}); });