fix: no compendium folder

This commit is contained in:
WinterMyst 2024-09-26 00:46:34 +00:00
parent 1ec482a98f
commit a514ad4367

View File

@ -129,18 +129,29 @@ function packageCompendiums(done) {
const outputDir = './packs'; const outputDir = './packs';
const moduleId = 'kidsonbrooms'; // Replace with your actual module ID const moduleId = 'kidsonbrooms'; // Replace with your actual module ID
if()
// Read all subdirectories in the packsDir // 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) => { fs.readdir(packsDir, (err, files) => {
if (err) { if (err) {
console.error(`Error reading directory ${packsDir}: ${err}`); console.error(`Error reading directory ${packsDir}: ${err}`);
process.exit(1); process.exit(1);
} }
// Filter out files to get only directories // Filter to get only directories
const folders = files.filter(file => fs.statSync(path.join(packsDir, file)).isDirectory()); const folders = files.filter(file => {
const fullPath = path.join(packsDir, file);
return fs.statSync(fullPath).isDirectory();
});
if (folders.length === 0) { if (folders.length === 0) {
console.log(`No compendium folders found in ${packsDir}`); console.log(`No compendium folders found in ${packsDir}. Skipping packaging.`);
done(); done();
return; return;
} }