mirror of
https://github.com/tiennm99/thptqg2017.git
synced 2026-09-10 14:20:37 +00:00
The four build variants existed only because the app could not resolve its own dataset. Now that it can, vite.config.js is a single build with an absolute base and no VARIANT switching, and the workflow compiles Rust once, installs Node dependencies once, and builds the site once — it previously built the same Rust crate twice and ran two separate pnpm installs. Because base is absolute, the emitted index.html references /thptqg/assets/... regardless of where it is served from, so the same file works as an entry point at any depth. scripts/assemble-site.js copies it to each dataset path and to the two legacy nested URLs, giving a real static file at every published route. That is what removes the need for an SPA 404-fallback redirect, which would otherwise have rewritten URLs and interfered with the ?q= deep links. Generated databases move to a gitignored .build/public, which Vite consumes as its publicDir. build-db.js gzips without -k, and the assemble step then refuses to finish if any uncompressed database artefact reached the output — .db, .db-journal, .db-wal or .db-shm. Previously a raw 100+ MB database was written into the source tree and deleted afterwards by an rm in the workflow, so shipping one was a missing cleanup step away. Both build scripts import DATASET_IDS from src/datasets.js rather than repeating the dataset list in workflow shell, so the four ids are declared in exactly one place across the frontend, the database build and the assembly. Verified by running the full pipeline locally and serving the artifact over HTTP: all nine routes return 200, every entry point is byte-identical, asset references are absolute, and the databases are fetchable. The guard was tested by injecting a raw .db and .db-journal into the build, which failed the assembly as intended.