Add utility script for extracting the compendia to JSON
This commit is contained in:
parent
696717aa1c
commit
a0f8566104
1 changed files with 27 additions and 0 deletions
27
scripts/extractCompendia.mjs
Normal file
27
scripts/extractCompendia.mjs
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { readFile } from "fs/promises";
|
||||||
|
import { join } from "path";
|
||||||
|
import { extractPack } 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(`Unpacking ${compendium.label} (${compendium.name})`);
|
||||||
|
let src = join(process.cwd(), compendium.path, `_source`);
|
||||||
|
await extractPack(
|
||||||
|
join(process.cwd(), compendium.path),
|
||||||
|
src,
|
||||||
|
{ recursive: true },
|
||||||
|
);
|
||||||
|
console.debug(`Finished packing ${compendium.name}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log(`Finished unpacking compendia`);
|
||||||
|
};
|
||||||
|
|
||||||
|
main();
|
||||||
Loading…
Add table
Add a link
Reference in a new issue