Add initial pack definitions
This commit is contained in:
parent
5b9e808ea9
commit
8f206baf46
5 changed files with 146 additions and 1 deletions
31
scripts/extractCompendia.mjs
Normal file
31
scripts/extractCompendia.mjs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { readFile } from "fs/promises";
|
||||
import { join } from "path";
|
||||
import { extractPack } from "@foundryvtt/foundryvtt-cli";
|
||||
import { pathToFileURL } from "url";
|
||||
|
||||
export async function extractCompendia() {
|
||||
const manifest = JSON.parse(await readFile(`./system.json`, `utf-8`));
|
||||
|
||||
if (!manifest.packs || manifest.packs.length === 0) {
|
||||
console.log(`No compendium packs defined`);
|
||||
process.exit(0);
|
||||
};
|
||||
console.log(`Extracting compendia`);
|
||||
|
||||
for (const compendium of manifest.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 unpacking compendium: ${compendium.name}`);
|
||||
};
|
||||
|
||||
console.log(`Finished unpacking all compendia`);
|
||||
};
|
||||
|
||||
if (import.meta.url === pathToFileURL(process.argv[1]).href) {
|
||||
extractCompendia();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue