refactor: hardcode API IDs and coaster lists, remove Playwright discovery
Embed Six Flags API IDs directly in the park registry and snapshot coaster lists from park-meta.json into a TypeScript module. This eliminates the Playwright-based discovery script, RCDB scraper, and runtime dependency on park-meta.json — preparing for the backend API transition. - Add apiId field to Park type and all 24 park entries - Create lib/coaster-data.ts with hardcoded coaster lists - Update page components to use park.apiId and new getCoasterSet() - Remove scripts/discover.ts, lib/scrapers/rcdb.ts, lib/park-meta.ts - Remove data/park-meta.json from shared volume - Remove playwright devDependency and discover npm script - Simplify scripts/scrape.ts (no RCDB, no discovery checks) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-13
@@ -9,7 +9,6 @@
|
||||
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { openDb, getApiId } from "../lib/db";
|
||||
import { PARKS } from "../lib/parks";
|
||||
import { scrapeMonthRaw } from "../lib/scrapers/sixflags";
|
||||
|
||||
@@ -52,16 +51,6 @@ async function main() {
|
||||
const month = parseInt(monthStr);
|
||||
const day = parseInt(dayStr);
|
||||
|
||||
const db = openDb();
|
||||
const apiId = getApiId(db, park.id);
|
||||
db.close();
|
||||
|
||||
if (apiId === null) {
|
||||
console.error(`No API ID found for ${park.name} — run: npm run discover`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Collect all output so we can write it to a file as well
|
||||
const lines: string[] = [];
|
||||
const out = (...args: string[]) => {
|
||||
const line = args.join(" ");
|
||||
@@ -70,13 +59,13 @@ async function main() {
|
||||
};
|
||||
|
||||
out(`Park : ${park.name} (${park.id})`);
|
||||
out(`API ID : ${apiId}`);
|
||||
out(`API ID : ${park.apiId}`);
|
||||
out(`Date : ${dateStr}`);
|
||||
out(`Fetched : ${new Date().toISOString()}`);
|
||||
out("");
|
||||
out(`Fetching ${year}-${String(month).padStart(2, "0")} from API...`);
|
||||
|
||||
const raw = await scrapeMonthRaw(apiId, year, month);
|
||||
const raw = await scrapeMonthRaw(park.apiId, year, month);
|
||||
|
||||
const targetDate = `${String(month).padStart(2, "0")}/${String(day).padStart(2, "0")}/${year}`;
|
||||
const dayData = raw.dates.find((d) => d.date === targetDate);
|
||||
|
||||
Reference in New Issue
Block a user