feat: update catalog to 396 hacks with generations/fakemon fields

This commit is contained in:
ginnoir
2026-06-25 15:56:55 -05:00
parent f3bc721d4a
commit d3647c3eda
6 changed files with 5082 additions and 1043 deletions
+1
View File
@@ -171,6 +171,7 @@
"mystery-dungeon-explorers-of-skies": "/assets/banners/mystery-dungeon-explorers-of-skies.jpg",
"mystery-dungeon-wigglytuff-s-bizarre-adventure": "/assets/banners/mystery-dungeon-wigglytuff-s-bizarre-adventure.png",
"mystery-mail-blooming-chaos": "/assets/banners/mystery-mail-blooming-chaos.png",
"myth-2": "/assets/banners/myth-2.png",
"myth": "/assets/banners/myth.png",
"mythic-silver": "/assets/banners/mythic-silver.webp",
"nameless": "/assets/banners/nameless.png",
+27
View File
@@ -29,6 +29,8 @@ const baseCatalog: RawCatalog = {
base: 'FireRed',
status: 'Complete',
version: '4.1',
generations: ['Gen I', 'Gen II', 'Gen III', 'Gen IV', 'Gen V', 'Gen VI', 'Gen VII', 'Gen VIII', 'Gen IX'],
fakemon: 'No',
developer: 'Soupercell',
release_date: '2024',
banner: 'https://romhacks-files.ginnoir.com/_meta/radical/banner.jpg',
@@ -104,6 +106,31 @@ describe('catalog normalization', () => {
expect(unknown?.searchText).not.toMatch(/\bnull\b|—/i);
});
it('normalizes roster generations and Fakemon metadata into chips', () => {
const catalog = normalizeCatalog(baseCatalog);
const radical = catalog.hacks.find((hack) => hack.slug === 'radical-red');
expect(radical?.generations).toEqual([
'Gen I',
'Gen II',
'Gen III',
'Gen IV',
'Gen V',
'Gen VI',
'Gen VII',
'Gen VIII',
'Gen IX',
]);
expect(radical?.fakemon).toBe('No');
expect(radical?.chips).toEqual(
expect.arrayContaining([
{ label: 'Roster', value: 'Gen I, Gen II, Gen III, Gen IV, Gen V, Gen VI, Gen VII, Gen VIII, Gen IX', kind: 'generation' },
{ label: 'Fakemon', value: 'No', kind: 'fakemon' },
]),
);
expect(radical?.searchText).toContain('gen ix');
});
it('maps ROM and library paths to internal file-server links', () => {
const catalog = normalizeCatalog(baseCatalog);
const radical = catalog.hacks.find((hack) => hack.slug === 'radical-red');
+8
View File
@@ -56,6 +56,8 @@ export function normalizeHack(raw: RawHack): SiteHack {
const developer = cleanText(raw.developer);
const releaseDate = cleanText(raw.release_date);
const generation = cleanText(raw.generation);
const generations = cleanList(raw.generations);
const fakemon = cleanText(raw.fakemon);
const scrapeDir = cleanText(raw.scrape_dir);
const libraryPath = cleanText(raw.library_path);
const banner = cleanText(raw.banner);
@@ -74,6 +76,8 @@ export function normalizeHack(raw: RawHack): SiteHack {
version,
status,
generation,
generations,
fakemon,
developer,
releaseDate,
banner,
@@ -106,10 +110,12 @@ export function normalizeHack(raw: RawHack): SiteHack {
hack.version,
hack.developer,
hack.releaseDate,
hack.fakemon,
hack.summary,
hack.notability,
hack.story,
...hack.types,
...hack.generations,
...hack.features,
]
.filter(Boolean)
@@ -216,6 +222,8 @@ function buildChips(hack: SiteHack): HackChip[] {
addChip(chips, 'status', 'Status', hack.status);
addChip(chips, 'developer', 'Dev', hack.developer);
addChip(chips, 'release_date', 'Release', hack.releaseDate);
addChip(chips, 'generation', 'Roster', hack.generations.join(', '));
addChip(chips, 'fakemon', 'Fakemon', hack.fakemon);
for (const type of hack.types) {
addChip(chips, 'type', 'Type', type);
}
+5 -1
View File
@@ -20,6 +20,8 @@ export interface RawHack {
version?: string | null;
status?: string | null;
generation?: string | null;
generations?: string[] | null;
fakemon?: string | null;
developer?: string | null;
release_date?: string | null;
banner?: string | null;
@@ -46,7 +48,7 @@ export interface ExternalLink {
export interface HackChip {
label: string;
value: string;
kind: 'platform' | 'base' | 'version' | 'status' | 'developer' | 'release_date' | 'type';
kind: 'platform' | 'base' | 'version' | 'status' | 'developer' | 'release_date' | 'generation' | 'fakemon' | 'type';
}
export interface FileLink {
@@ -64,6 +66,8 @@ export interface SiteHack {
version?: string;
status?: string;
generation?: string;
generations: string[];
fakemon?: string;
developer?: string;
releaseDate?: string;
banner?: string;