summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extension/scripts/typegen.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/extension/scripts/typegen.js b/extension/scripts/typegen.js
index 0bbff19e..ada39d47 100644
--- a/extension/scripts/typegen.js
+++ b/extension/scripts/typegen.js
@@ -46,8 +46,15 @@ function deleteAllInDir(dir) {
});
}
-OUTPUT_DIR = "schema";
-INPUT_DIR = "../schema/json";
+const OUTPUT_DIR = path.join("schema");
+const INPUT_DIR = path.join("..", "schema", "json");
+if (!fs.existsSync(INPUT_DIR)) {
+ throw new Error(`Input directory does not exist: ${INPUT_DIR}`);
+}
+
+if (!fs.existsSync(OUTPUT_DIR)) {
+ throw new Error(`Output directory does not exist: ${OUTPUT_DIR}`);
+}
deleteAllInDir(OUTPUT_DIR);
generateAllSchemas(INPUT_DIR, OUTPUT_DIR);