Begin work on the English documentation in a compendium
This commit is contained in:
parent
9b3751b281
commit
4b78ab4d01
7 changed files with 1392 additions and 0 deletions
32
scripts/buildCompendia.mjs
Normal file
32
scripts/buildCompendia.mjs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { existsSync } from "fs";
|
||||
import { readFile } from "fs/promises";
|
||||
import { join } from "path";
|
||||
import { compilePack } from "@foundryvtt/foundryvtt-cli";
|
||||
|
||||
async function main() {
|
||||
const manifest = JSON.parse(await readFile(`./public/module.json`, `utf-8`));
|
||||
|
||||
if (!manifest.packs || manifest.packs.length === 0) {
|
||||
console.log(`No compendium packs defined`);
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
for (const compendium of manifest.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();
|
||||
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 manifest = JSON.parse(await readFile(`./public/module.json`, `utf-8`));
|
||||
|
||||
if (!manifest.packs || manifest.packs.length === 0) {
|
||||
console.log(`No compendium packs defined`);
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
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 packing ${compendium.name}`);
|
||||
};
|
||||
|
||||
console.log(`Finished unpacking compendia`);
|
||||
};
|
||||
|
||||
main();
|
||||
Loading…
Add table
Add a link
Reference in a new issue