mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
Fixed so Pack handling works recursively for deep compendium folders (#47)
This commit is contained in:
parent
ad1e968888
commit
6672fa467c
355 changed files with 16040 additions and 5064 deletions
|
|
@ -4,9 +4,28 @@ import { promises as fs } from 'fs';
|
|||
const MODULE_ID = process.cwd();
|
||||
const yaml = false;
|
||||
|
||||
const packs = await fs.readdir('./src/packs');
|
||||
const packs = await deepGetDirectories('./packs');
|
||||
console.log(packs);
|
||||
for (const pack of packs) {
|
||||
if (pack === '.gitattributes') continue;
|
||||
console.log('Packing ' + pack);
|
||||
await compilePack(`${MODULE_ID}/src/packs/${pack}`, `${MODULE_ID}/packs/${pack}`, { yaml });
|
||||
await compilePack(`${MODULE_ID}/src/${pack}`, `${MODULE_ID}/${pack}`, { yaml });
|
||||
}
|
||||
|
||||
async function deepGetDirectories(distPath) {
|
||||
const dirr = await fs.readdir('src/' + distPath);
|
||||
const dirrsWithSub = [];
|
||||
for (let file of dirr) {
|
||||
const stat = await fs.stat('src/' + distPath + '/' + file);
|
||||
if (stat.isDirectory()) {
|
||||
const deeper = await deepGetDirectories(distPath + '/' + file);
|
||||
if (deeper.length > 0) {
|
||||
dirrsWithSub.push(...deeper);
|
||||
} else {
|
||||
dirrsWithSub.push(distPath + '/' + file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dirrsWithSub;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue