diff --git a/scripts/build-data.ts b/scripts/build-data.ts index 21986b4..ca367c9 100644 --- a/scripts/build-data.ts +++ b/scripts/build-data.ts @@ -1019,13 +1019,12 @@ interface VolcanoBuild { async function buildVolcanoes(plates: readonly PlateBuild[]): Promise { const volcanoes: VolcanoBuild[] = []; let page = 1; - let totalPages = 1; - do { + for (;;) { const response = await fetchJson<{ items: readonly VolcanoLocation[]; totalPages: number }>( `${VOLCANO_QUERY}?itemsPerPage=100&page=${page}`, `volcanoes_${page}.json`, ); - totalPages = response.totalPages; + const totalPages = response.totalPages; for (const item of response.items) { if (typeof item.latitude !== "number" || typeof item.longitude !== "number") { continue; @@ -1039,7 +1038,10 @@ async function buildVolcanoes(plates: readonly PlateBuild[]): Promise totalPages) { + break; + } + } const entries = volcanoes.map( (volcano) =>