Prevent erroring when the compendium doesn't have anything
This commit is contained in:
parent
411ddca927
commit
8971f25b9d
1 changed files with 7 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { existsSync } from "fs";
|
||||||
import { readFile } from "fs/promises";
|
import { readFile } from "fs/promises";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import { compilePack } from "@foundryvtt/foundryvtt-cli";
|
import { compilePack } from "@foundryvtt/foundryvtt-cli";
|
||||||
|
|
@ -12,8 +13,13 @@ async function main() {
|
||||||
|
|
||||||
for (const compendium of system.packs) {
|
for (const compendium of system.packs) {
|
||||||
console.debug(`Packing ${compendium.label} (${compendium.name})`);
|
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(
|
await compilePack(
|
||||||
join(process.cwd(), compendium.path, `_source`),
|
src,
|
||||||
join(process.cwd(), compendium.path),
|
join(process.cwd(), compendium.path),
|
||||||
{ recursive: true },
|
{ recursive: true },
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue