Add a compendium build step in the Github action

This commit is contained in:
Oliver-Akins 2024-02-13 21:08:13 -07:00
parent 1a102074d5
commit 411ddca927
4 changed files with 662 additions and 0 deletions

View file

@ -0,0 +1,26 @@
import { readFile } from "fs/promises";
import { join } from "path";
import { compilePack } from "@foundryvtt/foundryvtt-cli";
async function main() {
const system = JSON.parse(await readFile(`./system.json`, `utf-8`));
if (!system.packs || system.packs.length === 0) {
console.log(`No compendium packs defined`);
process.exit(0);
};
for (const compendium of system.packs) {
console.debug(`Packing ${compendium.label} (${compendium.name})`);
await compilePack(
join(process.cwd(), compendium.path, `_source`),
join(process.cwd(), compendium.path),
{ recursive: true },
);
console.debug(`Finished packing ${compendium.name}`);
};
console.log(`Finished packing compendia`)
};
main();