mirror of
https://github.com/tiennm99/thptqg.git
synced 2026-10-11 03:13:48 +00:00
The app was a single-entry React SPA: one index.html that the assembler copied to every dataset path, with a hand-rolled router resolving the dataset from window.location and the title patched in at runtime because one file had to serve every route. SvelteKit prerenders a real page per route instead. The entry generator in routes/[dataset]/+page.ts reads the same datasets.json the assembler does, so the set of pages and the set of databases cannot drift apart, and each dataset page ships its own <title> and description. Everything framework-free moved across unchanged in behaviour and became typed: the admission blocks, subject list, query classifier and SQL presets. `Student` now mirrors the 22-column table, so a mistyped column name fails the build rather than rendering blank. Tailwind replaces the stylesheet. Theme tokens are CSS variables, which keeps dark mode a single block of overrides rather than a `dark:` variant on every class. The score tiers stay hand-written CSS: the class is chosen at runtime from a score, and no utility generator can see that. Adds the tests the frontend never had, over the three modules where a silent wrong answer is possible — most importantly that toAscii here folds exactly as ToAscii does in the parser, which is what makes accent-insensitive search find anything. The assembler stops copying index.html per dataset and checks that the build prerendered each one instead. The database presence, raw-artifact and idempotence guards are untouched. Verified: 25 tests, ESLint and svelte-check clean, and a full `assemble site` producing /thptqg/, /thptqg/2016/, /thptqg/2017/ and 404.html with absolute asset URLs. Not verified in a browser — this machine has none.
36 lines
944 B
JSON
36 lines
944 B
JSON
{
|
|
"name": "thptqg-web",
|
|
"private": true,
|
|
"version": "1.0.0",
|
|
"type": "module",
|
|
"description": "Frontend — one SvelteKit app serving every dataset and the hub",
|
|
"scripts": {
|
|
"dev": "vite dev",
|
|
"build": "vite build",
|
|
"preview": "vite preview",
|
|
"test": "vitest run",
|
|
"lint": "eslint . && svelte-check --tsconfig ./tsconfig.json"
|
|
},
|
|
"dependencies": {
|
|
"sql.js": "^1.14.1"
|
|
},
|
|
"devDependencies": {
|
|
"@eslint/js": "^9.39.4",
|
|
"@sveltejs/adapter-static": "^3.0.10",
|
|
"@sveltejs/kit": "^2.70.2",
|
|
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
|
"@tailwindcss/vite": "^4.3.3",
|
|
"@types/sql.js": "^1.4.9",
|
|
"eslint": "^9.39.4",
|
|
"eslint-plugin-svelte": "^3.14.0",
|
|
"globals": "^17.4.0",
|
|
"svelte": "^5.56.9",
|
|
"svelte-check": "^4.4.3",
|
|
"tailwindcss": "^4.3.3",
|
|
"typescript": "^5.9.3",
|
|
"typescript-eslint": "^8.48.2",
|
|
"vite": "^7.1.14",
|
|
"vitest": "^4.1.10"
|
|
}
|
|
}
|