mirror of
https://github.com/tiennm99/thptqg.git
synced 2026-10-11 03:13:48 +00:00
* feat(xlsxread): vendor Rust binary cloned from thptqg2017 Copies the xlsxread Rust crate from thptqg2017@8b4a755 (chore/xlsxread-rust). Adds format_detect_2016 module with per-file column-layout auto-detection mirroring detectFormat() in scripts/build-database.js (lines 63-87): - separate-scores: SBD/HOTEN/TOAN... fixed columns (dhhanghai files) - mapped: header-derived SOBAODANH|SBD + DIEM_THI dynamic indices - default: positional 6-col layout (no header) Extends ParsedRow with ten_cum_thi and gioi_tinh fields. Adds SCORE_FIELDS_2016 (12 cols: tieng_duc/tieng_nhat; no khtn/khxh/tieng_nga). Adds thptqg2016-data.toml config with 18-column schema and format_detection flag. 58 tests pass (50 unit + 8 integration), 0 failures. * feat(build): wire build:db to xlsxread CLI Replaces the Node.js build:db script with the xlsxread Rust binary. Adds build:rust script for the cargo compile step in isolation. * chore: remove deprecated build-database.js Superseded by the xlsxread Rust binary. All 119 source files (4 .xls + 115 .xlsx) are now processed by xlsxread with per-file format detection. * ci: build xlsxread before running database build job Adds dtolnay/rust-toolchain@stable and Swatinem/rust-cache@v2 steps before the xlsxread build and database generation steps. Node/pnpm steps now follow the Rust build rather than preceding it. * chore: add Rust build artifacts to .gitignore * docs: update README build instructions for xlsxread pipeline * chore(deps): drop xlsx and better-sqlite3 from package.json and lockfile
45 lines
1.4 KiB
Bash
Executable File
45 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Re-sync xlsxread Rust source from thptqg2017.
|
|
#
|
|
# Source SHA: 8b4a755c115595bf1b937d749eb1133efb3a6e22 (chore/xlsxread-rust)
|
|
#
|
|
# Re-run this when xlsxread is updated upstream. The configs/ directory is
|
|
# NOT synced — it contains thptqg2016-specific configs and test stubs that
|
|
# must be maintained here independently.
|
|
#
|
|
# Usage:
|
|
# ./tools/sync-from-thptqg2017.sh /path/to/thptqg2017
|
|
#
|
|
set -euo pipefail
|
|
|
|
SRC="${1:?Usage: $0 /path/to/thptqg2017}"
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
DEST="$SCRIPT_DIR/xlsxread"
|
|
|
|
if [ ! -d "$SRC/tools/xlsxread" ]; then
|
|
echo "Error: $SRC/tools/xlsxread not found" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Syncing from: $SRC/tools/xlsxread"
|
|
echo "Syncing to: $DEST"
|
|
echo ""
|
|
|
|
# Sync source, tests, and Cargo manifests — exclude build artifacts and dataset configs
|
|
for item in src tests Cargo.toml Cargo.lock; do
|
|
if [ -e "$SRC/tools/xlsxread/$item" ]; then
|
|
cp -r "$SRC/tools/xlsxread/$item" "$DEST/"
|
|
echo " synced: $item"
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
echo "Sync complete."
|
|
echo "Next steps:"
|
|
echo " 1. Review src/ for breaking changes to config.rs / writer.rs that"
|
|
echo " may affect format_detect_2016.rs or the thptqg2016-data.toml config."
|
|
echo " 2. Rebuild: cargo build --release --manifest-path $DEST/Cargo.toml"
|
|
echo " 3. Test: cargo test --manifest-path $DEST/Cargo.toml"
|
|
echo " 4. Commit on a chore/xlsxread-sync-... branch."
|