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; }