diff --git a/scripts/buildTankopedia.ts b/scripts/buildTankopedia.ts index 8bfb9a00b..051aec443 100644 --- a/scripts/buildTankopedia.ts +++ b/scripts/buildTankopedia.ts @@ -1,5 +1,6 @@ import { Octokit } from '@octokit/rest'; import decompress from 'decompress'; +import { writeFileSync } from 'fs'; import { cp, mkdir, readFile, readdir, rm, writeFile } from 'fs/promises'; import { load } from 'js-yaml'; import { argv, env } from 'process'; @@ -56,6 +57,8 @@ const nations = await readdir( `${TEMP}/${directoriesOfInterest.vehicleDefinitions}`, ); +writeFileSync('test.json', JSON.stringify(strings, null, 2)); + Promise.all( nations .filter((nation) => nation !== 'common') @@ -73,7 +76,7 @@ Promise.all( const nationVehicleId = parseInt(list.root[vehicle].id._text); const id = (nationVehicleId << 8) + (NATION_IDS[nation] << 4) + 1; const name = strings[vehicleData.userString._text]; - const name_short = strings[vehicleData.shortUserString._text]; + const name_short = strings[vehicleData.shortUserString?._text]; const isPremium = 'gold' in vehicleData.price; const isCollector = vehicleData.sellPrice ? 'gold' in vehicleData.sellPrice @@ -82,9 +85,9 @@ Promise.all( const tags = vehicleData.tags._text.split(' '); const type = tags[0]; - // if ((name ?? name_short) === undefined) { - // console.log(vehicleData); - // } + if ((name ?? name_short) === undefined) { + console.log(vehicleData.userString._text); + } tankIds.push(id); tankopedia[id] = { diff --git a/src/app/tools/tankopedia/page.tsx b/src/app/tools/tankopedia/page.tsx index f03653954..a6d95cd13 100644 --- a/src/app/tools/tankopedia/page.tsx +++ b/src/app/tools/tankopedia/page.tsx @@ -22,22 +22,37 @@ export default async function Page() { }} > - + > + - - + {tank.name_short ?? tank.name ?? `Unknown tank ${tank.id}`} + + {tank.tree_type !== 'tech-tree' && ( ; -export const tankopedia = fetch(asset('tankopedia.json')).then( - async (response) => response.json() as Promise, -); +export const tankopedia = fetch(asset('tankopedia.json'), { + cache: 'no-store', +}).then(async (response) => response.json() as Promise); const entries = new Promise(async (resolve) => { resolve(Object.entries(await tankopedia).map(([, entry]) => entry)); });