mirror of
https://github.com/tiennm99/thptqg2016.git
synced 2026-05-14 10:59:00 +00:00
1.9 KiB
1.9 KiB
Deployment Guide
Automatic (recommended)
Push to main → GitHub Actions builds and deploys to GitHub Pages automatically.
Workflow: .github/workflows/deploy.yml
CI steps:
npm cinpm run build:db— generatepublic/thptqg2016.dbfromdata/*.xlsxgzip -k -9 public/thptqg2016.db— max compression, keep originalnpm run build— Vite bundlesdist/rm -f dist/thptqg2016.db— ship only the gzipped copyactions/upload-pages-artifact@v3+actions/deploy-pages@v4
One-time setup: Settings → Pages → Source: GitHub Actions.
Manual (local verification)
npm install
npm run build:db
gzip -k -9 public/thptqg2016.db # Linux/macOS; on Windows use 7zip or WSL
npm run build
rm dist/thptqg2016.db # optional, shrinks artifact
npm run preview # serve dist/ locally
Open http://localhost:4173/thptqg2016/.
Base path
vite.config.js sets base: "/thptqg2016/". If you fork under a different repo name, update this to match <repo-name> so assets resolve correctly on GitHub Pages.
Updating data
- Add the new Excel file to
data/. - If its header is unfamiliar, open
scripts/build-database.jsand extenddetectFormat()or theprocessSeparateScoresRow/processMappedRowhelpers. - Run
npm run build:dblocally to check row counts and error skips. - Commit + push → CI redeploys.
Troubleshooting
| Symptom | Typical cause |
|---|---|
| Blank page, 404 on assets | base in vite.config.js doesn't match the repo name |
Failed to fetch database: 404 |
gzip step skipped, or .db.gz removed from dist/ |
| WASM fails to load | sql.js.org blocked / offline — self-host sql-wasm.wasm in public/ and update SQL_WASM_URL in use-sqlite.js |
| Missing rows after build | Excel file has an unknown header — check console for Failed to read or errorCount |