From a514ad43675d5580c538d1f189d7a55eb94da335 Mon Sep 17 00:00:00 2001 From: WinterMyst <22961076-wintermyst@users.noreply.gitlab.com> Date: Thu, 26 Sep 2024 00:46:34 +0000 Subject: [PATCH] fix: no compendium folder --- gulpfile.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index acbaa69..d07a9a2 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -129,18 +129,29 @@ function packageCompendiums(done) { const outputDir = './packs'; const moduleId = 'kidsonbrooms'; // Replace with your actual module ID + if() // Read all subdirectories in the packsDir + if (!fs.existsSync(packsDir)) { + console.log(`Compendium directory ${packsDir} does not exist. Skipping packaging.`); + done(); + return; + } + + // Read all files and directories in the packsDir fs.readdir(packsDir, (err, files) => { if (err) { console.error(`Error reading directory ${packsDir}: ${err}`); process.exit(1); } - // Filter out files to get only directories - const folders = files.filter(file => fs.statSync(path.join(packsDir, file)).isDirectory()); + // Filter to get only directories + const folders = files.filter(file => { + const fullPath = path.join(packsDir, file); + return fs.statSync(fullPath).isDirectory(); + }); if (folders.length === 0) { - console.log(`No compendium folders found in ${packsDir}`); + console.log(`No compendium folders found in ${packsDir}. Skipping packaging.`); done(); return; }