From dc0622848b648ba27e7110b9b900673bb668ab4c Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 9 Aug 2023 19:21:57 -0700 Subject: fix: :bug: make typegen.js windows compatible --- extension/scripts/typegen.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'extension') 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); -- cgit v1.2.3-70-g09d2