mirror of
https://github.com/tiennm99/thptqg.git
synced 2026-10-04 18:13:58 +00:00
Sites: /thptqg2017/ → data/ 861,068 students (baotintuc.vn .xls) /thptqg2017/old/ → data-old/ 847,348 students (original xlsx) /thptqg2017/old2/ → data-old2/ 679,764 students (update/ overrides) Build pipeline: - scripts/build-lib.js: shared schema, score regex, toAscii, insert builder — keeps the 3 DBs drop-in compatible for the same frontend - scripts/build-database.js: multi-sheet walk for baotintuc .xls (HN/HCM overflow past the 65k-per-sheet .xls cap) - scripts/build-database-old.js: single-sheet xlsx + strict numeric SBD guard (rejects the header-row leak present in data-old) - scripts/build-database-old2.js: multi-sheet + blank-row pre-filter for the 54 update files (HCM overflow present, HN not in this subset) - Each build prints a source-vs-DB audit; verified 0 parse errors and exact row-count match across all 3 datasets Frontend plumbing: - vite.config.js: VARIANT env selects base path, publicDir, outDir - package.json: build:db:*, build:db:all, build:old, build:old2, build:all - .github/workflows/deploy.yml: CI builds all 3 DBs + sites - .gitignore: cover public-old/ and public-old2/ outputs - eslint.config.js: add Node globals for config/script files
26 lines
930 B
JavaScript
26 lines
930 B
JavaScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
// VARIANT selects which dataset to ship:
|
|
// (unset) → main site at /thptqg2017/ using public/
|
|
// old → at /thptqg2017/old/ using public-old/
|
|
// old2 → at /thptqg2017/old2/ using public-old2/
|
|
const VARIANT = process.env.VARIANT || "";
|
|
const VARIANT_CONFIG = {
|
|
"": { base: "/thptqg2017/", publicDir: "public", outDir: "dist" },
|
|
old: { base: "/thptqg2017/old/", publicDir: "public-old", outDir: "dist/old" },
|
|
old2: { base: "/thptqg2017/old2/", publicDir: "public-old2", outDir: "dist/old2" },
|
|
};
|
|
const cfg = VARIANT_CONFIG[VARIANT];
|
|
if (!cfg) throw new Error(`Unknown VARIANT: ${VARIANT}`);
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
base: cfg.base,
|
|
publicDir: cfg.publicDir,
|
|
build: {
|
|
outDir: cfg.outDir,
|
|
emptyOutDir: VARIANT === "", // only main build wipes dist root
|
|
},
|
|
});
|