Skip to content

Commit

Permalink
Update NPM dependencies (foundryvtt#10963)
Browse files Browse the repository at this point in the history
Includes codebase update on account of prettier 3
  • Loading branch information
stwlam authored Oct 28, 2023
1 parent 4c322c5 commit d25a333
Show file tree
Hide file tree
Showing 471 changed files with 2,762 additions and 2,295 deletions.
14 changes: 7 additions & 7 deletions build/lib/compendium-pack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class CompendiumPack {

constructor(packDir: string, parsedData: unknown[], parsedFolders: unknown[]) {
const metadata = CompendiumPack.#packsMetadata.find(
(pack) => path.basename(pack.path) === path.basename(packDir)
(pack) => path.basename(pack.path) === path.basename(packDir),
);
if (metadata === undefined) {
throw PackError(`Compendium at ${packDir} has no metadata in the local system.json file.`);
Expand Down Expand Up @@ -151,7 +151,7 @@ class CompendiumPack {
const repoImgPath = path.resolve(
process.cwd(),
"static",
decodeURIComponent(imgPath).replace("systems/pf2e/", "")
decodeURIComponent(imgPath).replace("systems/pf2e/", ""),
);
if (!isCoreIconPath && !fs.existsSync(repoImgPath)) {
throw PackError(`${documentName} (${this.packId}) has an unknown image path: ${imgPath}`);
Expand Down Expand Up @@ -303,11 +303,11 @@ class CompendiumPack {

#sourceIdOf(
documentId: string,
{ packId = this.packId, docType }: { packId?: string; docType: "Actor" }
{ packId = this.packId, docType }: { packId?: string; docType: "Actor" },
): CompendiumActorUUID;
#sourceIdOf(
documentId: string,
{ packId = this.packId, docType }: { packId?: string; docType: "Item" }
{ packId = this.packId, docType }: { packId?: string; docType: "Item" },
): CompendiumItemUUID;
#sourceIdOf(documentId: string, { packId = this.packId, docType }: { packId?: string; docType: string }): string;
#sourceIdOf(documentId: string, { packId = this.packId, docType }: { packId?: string; docType: string }): string {
Expand All @@ -317,7 +317,7 @@ class CompendiumPack {
/** Convert UUIDs in REs to resemble links by name or back again */
static convertUUIDs(
source: ItemSourcePF2e,
{ to, map }: { to: "ids" | "names"; map: Map<string, Map<string, string>> }
{ to, map }: { to: "ids" | "names"; map: Map<string, Map<string, string>> },
): void {
const convertOptions = { to: to === "ids" ? "id" : "name", map } as const;

Expand All @@ -340,7 +340,7 @@ class CompendiumPack {
const hasUUIDChoices = (choices: object | string | undefined): choices is Record<string, { value: string }> =>
typeof choices === "object" &&
Object.values(choices ?? {}).every(
(c): c is { value: unknown } => typeof c.value === "string" && c.value.startsWith("Compendium.pf2e.")
(c): c is { value: unknown } => typeof c.value === "string" && c.value.startsWith("Compendium.pf2e."),
);

const rules: REMaybeWithUUIDs[] = source.system.rules;
Expand Down Expand Up @@ -457,7 +457,7 @@ class CompendiumPack {

if (failedChecks.length > 0) {
throw PackError(
`Document source in (${this.packId}) has invalid or missing keys: ${failedChecks.join(", ")}`
`Document source in (${this.packId}) has invalid or missing keys: ${failedChecks.join(", ")}`,
);
}

Expand Down
24 changes: 12 additions & 12 deletions build/lib/extractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class PackExtractor {

console.log(`Finished extracting ${sourceCount} documents from pack ${dbDirectory}`);
return sourceCount;
})
}),
)
).reduce((runningTotal, count) => runningTotal + count, 0);
}
Expand All @@ -140,7 +140,7 @@ class PackExtractor {
const getFolderPath = (folder: DBFolder, parts: string[] = []): string => {
if (parts.length > 3) {
throw PackError(
`Error: Maximum folder depth exceeded for "${folder.name}" in pack: ${packDirectory}`
`Error: Maximum folder depth exceeded for "${folder.name}" in pack: ${packDirectory}`,
);
}
parts.unshift(sluggify(folder.name));
Expand Down Expand Up @@ -229,7 +229,7 @@ class PackExtractor {
if (oldSource._id !== newSource._id) {
throw PackError(
`The ID of doc "${newSource.name}" (${newSource._id}) does not match the current ID ` +
`(${oldSource._id}). Documents that are already in the system must keep their current ID.`
`(${oldSource._id}). Documents that are already in the system must keep their current ID.`,
);
}
}
Expand Down Expand Up @@ -314,7 +314,7 @@ class PackExtractor {
if (typeof slug === "string" && slug !== sluggify(docSource.name)) {
console.warn(
`Warning: Name change detected on ${docSource.name}. ` +
"Please remember to create a slug migration before next release."
"Please remember to create a slug migration before next release.",
);
}

Expand Down Expand Up @@ -347,7 +347,7 @@ class PackExtractor {
} catch (error) {
console.error(error);
throw PackError(
`Failed to parse description of ${docSource.name} (${docSource._id}):\n${description}`
`Failed to parse description of ${docSource.name} (${docSource._id}):\n${description}`,
);
}
})();
Expand Down Expand Up @@ -421,7 +421,7 @@ class PackExtractor {
if ("img" in docSource && typeof docSource.img === "string") {
docSource.img = docSource.img.replace(
"https://assets.forge-vtt.com/bazaar/systems/pf2e/assets/",
"systems/pf2e/"
"systems/pf2e/",
) as ImageFilePath;
}

Expand Down Expand Up @@ -543,7 +543,7 @@ class PackExtractor {
}
} else if (source.type === "feat") {
const isFeat = !["ancestryfeature", "classfeature", "pfsboon", "deityboon", "curse"].includes(
source.system.category
source.system.category,
);
if (isFeat && source.img === "systems/pf2e/icons/default-icons/feat.svg") {
source.img = "systems/pf2e/icons/features/feats/feats.webp";
Expand Down Expand Up @@ -656,7 +656,7 @@ class PackExtractor {
if (!itemTypeList.includes(key)) {
if (this.emitWarnings) {
console.log(
`Warning in ${docSource.name}: Item type '${key}' is currently unhandled in sortDataItems. Consider adding.`
`Warning in ${docSource.name}: Item type '${key}' is currently unhandled in sortDataItems. Consider adding.`,
);
}
for (const item of itemSet) {
Expand Down Expand Up @@ -727,7 +727,7 @@ class PackExtractor {
[
new RegExp(
"(\\+|\\-)\\d+ (Status|Circumstance) (Bonus )?(to|on) ((All|Fortitude|Reflex|Will) )?Saves",
"i"
"i",
),
"top",
],
Expand Down Expand Up @@ -772,7 +772,7 @@ class PackExtractor {
const notAbilityMatch = notAbilities.find((naName) => ability.name.match(naName[0]));
if (notAbilityMatch) {
console.log(
`Error in ${docName}: ${notAbilityMatch[0]} has type action but should be type ${notAbilityMatch[1]}!`
`Error in ${docName}: ${notAbilityMatch[0]} has type action but should be type ${notAbilityMatch[1]}!`,
);
}

Expand Down Expand Up @@ -820,7 +820,7 @@ class PackExtractor {
#sortItemsWithOverrides(
docName: string,
actions: ItemSourcePF2e[],
overrides: Map<RegExp, "top" | "bottom">
overrides: Map<RegExp, "top" | "bottom">,
): ItemSourcePF2e[] {
const topActions: ItemSourcePF2e[] = [];
const middleActions: ItemSourcePF2e[] = [];
Expand All @@ -836,7 +836,7 @@ class PackExtractor {
} else {
if (this.emitWarnings) {
console.log(
`Warning in ${docName}: Override item '${regexp}' has undefined override section '${position}', should be top or bottom!`
`Warning in ${docName}: Override item '${regexp}' has undefined override section '${position}', should be top or bottom!`,
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions build/lib/level-database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class LevelDatabase extends ClassicLevel<string, DBEntry> {
if (this.#embeddedKey) {
this.#embeddedDb = this.sublevel(
`${this.#dbkey}.${this.#embeddedKey}`,
dbOptions
dbOptions,
) as unknown as Sublevel<EmbeddedEntry>;
}
}
Expand Down Expand Up @@ -80,7 +80,7 @@ class LevelDatabase extends ClassicLevel<string, DBEntry> {
const embeddedKey = this.#embeddedKey;
if (embeddedKey && source[embeddedKey] && this.#embeddedDb) {
const embeddedDocs = await this.#embeddedDb.getMany(
source[embeddedKey]?.map((embeddedId) => `${docId}.${embeddedId}`) ?? []
source[embeddedKey]?.map((embeddedId) => `${docId}.${embeddedId}`) ?? [],
);
source[embeddedKey] = compact(embeddedDocs);
}
Expand All @@ -99,7 +99,7 @@ class LevelDatabase extends ClassicLevel<string, DBEntry> {
const metadata = systemJSON.packs.find((p) => p.path.endsWith(packName));
if (!metadata) {
throw PackError(
`Error generating dbKeys: Compendium ${packName} has no metadata in the local system.json file.`
`Error generating dbKeys: Compendium ${packName} has no metadata in the local system.json file.`,
);
}

Expand Down
Loading

0 comments on commit d25a333

Please sign in to comment.