Initial commit

This commit is contained in:
Oliver 2024-08-28 21:23:31 -06:00 committed by GitHub
commit 60b0072bcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 6462 additions and 0 deletions

View file

@ -0,0 +1,32 @@
import { compilePack } from "@foundryvtt/foundryvtt-cli";
import { existsSync } from "fs";
import { join } from "path";
import { readFile } from "fs/promises";
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})`);
let src = join(process.cwd(), compendium.path, `_source`);
if (!existsSync(src)) {
console.warn(`${compendium.path} doesn't exist, skipping.`)
continue;
};
await compilePack(
src,
join(process.cwd(), compendium.path),
{ recursive: true },
);
console.debug(`Finished packing ${compendium.name}`);
};
console.log(`Finished packing compendia`)
};
main();

View 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();

View file

@ -0,0 +1,4 @@
const invalids = game.actors.invalidDocumentIds;
invalids.forEach(id => {
game.actors.getInvalid(id).delete();
});

View file

@ -0,0 +1,4 @@
const invalids = game.items.invalidDocumentIds;
invalids.forEach(id => {
game.items.getInvalid(id).delete();
});