Prune stats when extracting (#1359)

This commit is contained in:
Carlos Fernandez 2025-12-05 17:36:03 -08:00 committed by GitHub
parent e3f244d8d7
commit 1fbce2507a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
1176 changed files with 994 additions and 21422 deletions

View file

@ -22,7 +22,8 @@ for (const pack of packs) {
}
await extractPack(`${MODULE_ID}/${pack}`, `${MODULE_ID}/src/${pack}`, {
yaml,
transformName
transformName,
transformEntry,
});
}
/**
@ -37,6 +38,23 @@ function transformName(doc) {
return `${doc.name ? `${prefix}_${safeFileName}_${doc._id}` : doc._id}.${yaml ? 'yml' : 'json'}`;
}
function transformEntry(entry) {
function prune(stats) {
return stats ? { compendiumSource: stats.compendiumSource } : stats;
}
delete entry._stats;
for (const effect of entry.effects ?? []) {
effect._stats = prune(effect._stats)
}
for (const item of entry.items ?? []) {
item._stats = prune(item._stats);
for (const effect of item.effects ?? []) {
effect._stats = prune(effect._stats)
}
}
}
async function deepGetDirectories(distPath) {
const dirr = await fs.readdir(distPath);
const dirrsWithSub = [];