Standardize public images on WebP and add conversion tooling
All checks were successful
Deploy Sokko G / deploy (push) Successful in 20s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 20s
This commit is contained in:
parent
75592d7d7a
commit
ca39b76282
883 changed files with 503 additions and 90 deletions
|
|
@ -10,6 +10,11 @@ const readJson = async (path) => JSON.parse(await readFile(`website/public/data/
|
|||
const [aniimos, fr, en] = await Promise.all([readJson("aniimo/aniimos.json"), readJson("aniimo/i18n/fr.json"), readJson("aniimo/i18n/en.json")]);
|
||||
const data = prepareAniimoData(aniimos, fr, en);
|
||||
|
||||
function readWebpCanvasSize(webp) {
|
||||
assert.equal(webp.toString("ascii", 12, 16), "VP8X");
|
||||
return [webp.readUIntLE(24, 3) + 1, webp.readUIntLE(27, 3) + 1];
|
||||
}
|
||||
|
||||
test("Aniimo attributes have valid stats and matching totals", () => {
|
||||
validateAniimoData(aniimos, [fr, en]);
|
||||
const invalid = structuredClone(aniimos[0]);
|
||||
|
|
@ -24,14 +29,15 @@ test("Aniimo data has valid variants, translations, portraits and icons", async
|
|||
validateAniimoData(aniimos, [fr, en]);
|
||||
const game = (await readJson("games.json")).games.find((game) => game.id === "aniimo");
|
||||
assert.ok(game);
|
||||
assert.equal(game.images.aniimosCover, "/static/img/aniimo/emberpup__basic_form.png");
|
||||
assert.equal(game.images.aniimosCover, "/static/img/aniimo/emberpup__basic_form.webp");
|
||||
const assets = new Set([game.images.cardCover, game.images.heroBg, game.images.aniimosCover, ...data.variants.map((variant) => variant.image)]);
|
||||
for (const option of Object.values(data.filterOptions).flat()) assets.add(`/static/img/aniimo/${option}.png`);
|
||||
for (const option of Object.values(data.filterOptions).flat()) assets.add(`/static/img/aniimo/${option}.webp`);
|
||||
await Promise.all([...assets].map((asset) => access(`website/public${asset}`)));
|
||||
for (const variant of data.variants) {
|
||||
const png = await readFile(`website/public${variant.image}`);
|
||||
assert.equal(png.readUInt32BE(16), 512);
|
||||
assert.equal(png.readUInt32BE(20), 840);
|
||||
const webp = await readFile(`website/public${variant.image}`);
|
||||
assert.equal(webp.toString("ascii", 0, 4), "RIFF");
|
||||
assert.equal(webp.toString("ascii", 8, 12), "WEBP");
|
||||
assert.deepEqual(readWebpCanvasSize(webp), [512, 840]);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ test("mhwilds data and assets are available", async () => {
|
|||
assert.ok(site.toolboxes.storageHelp.items.length >= 3);
|
||||
assert.equal(games.games[0].id, "mhwilds");
|
||||
assert.equal(games.games[0].eyebrow, "Guide de jeu");
|
||||
assert.match(games.games[0].images.cardCover, /games\/mhwilds\/card-cover\.png/);
|
||||
assert.match(games.games[0].images.heroBg, /games\/mhwilds\/hero-bg\.png/);
|
||||
assert.match(games.games[0].images.cardCover, /games\/mhwilds\/card-cover\.webp/);
|
||||
assert.match(games.games[0].images.heroBg, /games\/mhwilds\/hero-bg\.webp/);
|
||||
assert.ok(monsters.monsters.length > 0);
|
||||
assert.deepEqual(monsters.elements, ["fire", "water", "thunder", "ice", "dragon"]);
|
||||
validateMonsterData(monsters.monsters);
|
||||
|
|
@ -105,9 +105,9 @@ test("mhwilds data and assets are available", async () => {
|
|||
const monsterCardSource = await readFile("website/src/features/games/mhwilds/cards/MonsterCard.jsx", "utf8");
|
||||
assert.match(monsterCardSource, /monster-card/);
|
||||
assert.match(monsterCardSource, /monster\.hitzones/);
|
||||
await readFile("website/public/static/img/mhwilds/chatacabra.png");
|
||||
await readFile("website/public/static/img/games/mhwilds/card-cover.png");
|
||||
await readFile("website/public/static/img/games/mhwilds/hero-bg.png");
|
||||
await readFile("website/public/static/img/mhwilds/chatacabra.webp");
|
||||
await readFile("website/public/static/img/games/mhwilds/card-cover.webp");
|
||||
await readFile("website/public/static/img/games/mhwilds/hero-bg.webp");
|
||||
});
|
||||
|
||||
test("diablo4 data and route are available", async () => {
|
||||
|
|
@ -119,14 +119,14 @@ test("diablo4 data and route are available", async () => {
|
|||
const diablo4Game = games.games.find((game) => game.id === "diablo4");
|
||||
|
||||
assert.ok(diablo4Game, "games.json must declare diablo4");
|
||||
assert.match(diablo4Game.images.cardCover, /games\/diablo4\/card-cover\.png/);
|
||||
assert.match(diablo4Game.images.heroBg, /games\/diablo4\/hero-bg\.png/);
|
||||
assert.match(diablo4Game.images.cardCover, /games\/diablo4\/card-cover\.webp/);
|
||||
assert.match(diablo4Game.images.heroBg, /games\/diablo4\/hero-bg\.webp/);
|
||||
validateDiablo4Affixes(affixes);
|
||||
assert.match(routeSource, /game\.id === "diablo4"/);
|
||||
assert.match(pageSource, /category === "affixes"/);
|
||||
assert.match(listingSource, /diablo4\.filterOptions\.affixes/);
|
||||
await readFile("website/public/static/img/games/diablo4/card-cover.png");
|
||||
await readFile("website/public/static/img/games/diablo4/hero-bg.png");
|
||||
await readFile("website/public/static/img/games/diablo4/card-cover.webp");
|
||||
await readFile("website/public/static/img/games/diablo4/hero-bg.webp");
|
||||
await readFile("website/public/static/icons/axe.svg");
|
||||
await readFile("website/public/static/icons/cube.svg");
|
||||
await readFile("website/public/static/icons/fire.svg");
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ test("vite entrypoint and app shell are wired", async () => {
|
|||
assert.match(routeContent, /features\/games\/GameRoute\.jsx/);
|
||||
assert.doesNotMatch(shell, /content\.navigation\.library/);
|
||||
assert.match(shell, /sidebar-about-link/);
|
||||
assert.match(shell, /dragon-sidebar\.png/);
|
||||
assert.match(shell, /dragon-sidebar\.webp/);
|
||||
assert.match(shell, /ImportButton/);
|
||||
assert.match(shell, /compactSidebar/);
|
||||
assert.match(shell, /reducedSidebar/);
|
||||
|
|
@ -48,7 +48,7 @@ test("vite entrypoint and app shell are wired", async () => {
|
|||
assert.match(overlays, /uid\("marker"\)/);
|
||||
assert.match(imageViewer, /export function ImageViewer/);
|
||||
assert.match(imageViewer, /function openImageInNewTab/);
|
||||
assert.match(homePage, /dragon-home\.png/);
|
||||
assert.match(homePage, /dragon-home\.webp/);
|
||||
assert.match(aboutPage, /module-icon-\$\{group\.icon \|\| "notepad"\}/);
|
||||
});
|
||||
|
||||
|
|
@ -112,20 +112,20 @@ test("legacy icons and primary images are available", async () => {
|
|||
await readFile("website/public/static/icons/shield.svg", "utf8");
|
||||
await readFile("website/public/static/icons/wing.svg", "utf8");
|
||||
await readFile("website/public/favicon.ico");
|
||||
await readFile("website/public/static/img/dragon-home.png");
|
||||
await readFile("website/public/static/img/dragon-sidebar.png");
|
||||
await readFile("website/public/static/img/dragon-dual-monitor.png");
|
||||
await readFile("website/public/static/img/dragon-session-tools.png");
|
||||
await readFile("website/public/static/img/dragon-game-guides.png");
|
||||
await readFile("website/public/static/img/dragon-local-data.png");
|
||||
await readFile("website/public/static/img/dragon-contribution-data.png");
|
||||
await readFile("website/public/static/img/dragon-gameguide.png");
|
||||
await readFile("website/public/static/img/dragon-toolbox.png");
|
||||
await readFile("website/public/static/img/onboarding/toolbox-overview.png");
|
||||
await readFile("website/public/static/img/onboarding/toolbox-tools.png");
|
||||
await readFile("website/public/static/img/onboarding/toolbox-save.png");
|
||||
await readFile("website/public/static/img/onboarding/toolbox-game-link.png");
|
||||
await readFile("website/public/static/img/toolbox-icons/toolbox.png");
|
||||
await readFile("website/public/static/img/toolbox-icons/sword.png");
|
||||
await readFile("website/public/static/img/toolbox-icons/puzzle.png");
|
||||
await readFile("website/public/static/img/dragon-home.webp");
|
||||
await readFile("website/public/static/img/dragon-sidebar.webp");
|
||||
await readFile("website/public/static/img/dragon-dual-monitor.webp");
|
||||
await readFile("website/public/static/img/dragon-session-tools.webp");
|
||||
await readFile("website/public/static/img/dragon-game-guides.webp");
|
||||
await readFile("website/public/static/img/dragon-local-data.webp");
|
||||
await readFile("website/public/static/img/dragon-contribution-data.webp");
|
||||
await readFile("website/public/static/img/dragon-gameguide.webp");
|
||||
await readFile("website/public/static/img/dragon-toolbox.webp");
|
||||
await readFile("website/public/static/img/onboarding/toolbox-overview.webp");
|
||||
await readFile("website/public/static/img/onboarding/toolbox-tools.webp");
|
||||
await readFile("website/public/static/img/onboarding/toolbox-save.webp");
|
||||
await readFile("website/public/static/img/onboarding/toolbox-game-link.webp");
|
||||
await readFile("website/public/static/img/toolbox-icons/toolbox.webp");
|
||||
await readFile("website/public/static/img/toolbox-icons/sword.webp");
|
||||
await readFile("website/public/static/img/toolbox-icons/puzzle.webp");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import { formatUpdatedAt, isHtmlEmpty, queryBlockFormat, queryCommandState } fro
|
|||
import { createBalancedTeams, drawWeightedEntries, filterExclusionsForPlayers, getDiceShape, rollDice } from "../website/src/features/toolboxes/modules/randomizerUtils.js";
|
||||
import { calculateAtLeastOneProbability, calculateDrawsForChance, calculateRngCostSummary, calculateRngRealDrawsSummary, calculateRngSummary, getAveragePositionStatus, getDurationPresetsForAverageHours, getEffectiveRate, normalizeCostString, normalizeRateString, simulateRngDraws } from "../website/src/features/toolboxes/modules/rngSimulatorUtils.js";
|
||||
import { getTimePatternRecurrenceMs, getTimePatternTargetMs } from "../website/src/features/toolboxes/modules/timerUtils.js";
|
||||
import { compactModuleDataForStorage, createToolboxExportPayload, moduleStorageKey, normalizeCalculatorData, normalizeChecklistData, normalizeCombosData, normalizeCountersData, normalizeEquipmentPlannerData, normalizeGoalTreeData, normalizeImageAnnotationData, normalizeLinksData, normalizeMemosData, normalizeModuleOrder, normalizeNotepadData, normalizeRandomizerData, normalizeRngSimulatorData, normalizeTableData, normalizeTaskPlannerData, normalizeTimerData, normalizeToolbox, normalizeUrl, remapMemosPlannerLink, summarizeEquipmentPlannerData } from "../website/src/features/toolboxes/storage/toolboxStorage.js";
|
||||
import { compactModuleDataForStorage, createToolboxExportPayload, moduleStorageKey, normalizeCalculatorData, normalizeChecklistData, normalizeCombosData, normalizeCountersData, normalizeEquipmentPlannerData, normalizeGoalTreeData, normalizeImageAnnotationData, normalizeLinksData, normalizeMemosData, normalizeModuleOrder, normalizeNotepadData, normalizeRandomizerData, normalizeRngSimulatorData, normalizeTableData, normalizeTaskPlannerData, normalizeTimerData, normalizeToolbox, normalizeToolboxIcon, normalizeUrl, remapMemosPlannerLink, summarizeEquipmentPlannerData } from "../website/src/features/toolboxes/storage/toolboxStorage.js";
|
||||
import { createToolboxSpace, deleteToolboxSpace, moveToolboxModule, reorderToolboxSpaces } from "../website/src/features/toolboxes/toolboxSpaceUtils.js";
|
||||
import { applyGroupedReorderOperation, completeGroupOrder, getBoundaryItemId, getGroupedEntries, moveGroupOrder, moveGroupOrderToEnd, moveGroupOrderToStart, moveItem, moveItemGroup } from "../website/src/hooks/useGroupedReorder.js";
|
||||
|
||||
|
|
@ -1014,6 +1014,12 @@ test("toolbox modules preserve only active shell display options", () => {
|
|||
assert.equal("collapsed" in toolbox.modules[1], false);
|
||||
});
|
||||
|
||||
test("legacy PNG toolbox icons normalize to canonical WebP paths", () => {
|
||||
assert.equal(normalizeToolboxIcon("/static/img/toolbox-icons/sword.png"), "/static/img/toolbox-icons/sword.webp");
|
||||
assert.equal(normalizeToolboxIcon("/static/img/toolbox-icons/sword.webp"), "/static/img/toolbox-icons/sword.webp");
|
||||
assert.equal(normalizeToolboxIcon("/static/img/toolbox-icons/unknown.png"), "/static/img/toolbox-icons/toolbox.webp");
|
||||
});
|
||||
|
||||
test("legacy toolbox order becomes a persistent default space", () => {
|
||||
const legacy = {
|
||||
id: "legacy",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue