File Name
scripts/sync-leaderboard.js
Problem
While the script explicitly creates the user-data directory using fsPromises.mkdir({ recursive: true }) before writing files, it does not ensure that the daily directory (DATA_DIR/daily) exists. If the daily folder is missing (e.g., in a fresh repository clone or after a clean-up step), writing the daily snapshot via atomicWrite will crash with an ENOENT error.
Proposed Solution
Explicitly create the daily output directory recursively prior to writing daily JSON files, similar to how user-data is handled.
Implementation Details
- Directory Initialization: Add a directory creation check before writing daily data:
await fsPromises.mkdir(path.join(DATA_DIR, "daily"), { recursive: true });
File Name
scripts/sync-leaderboard.jsProblem
While the script explicitly creates the
user-datadirectory usingfsPromises.mkdir({ recursive: true })before writing files, it does not ensure that thedailydirectory (DATA_DIR/daily) exists. If thedailyfolder is missing (e.g., in a fresh repository clone or after a clean-up step), writing the daily snapshot viaatomicWritewill crash with anENOENTerror.Proposed Solution
Explicitly create the
dailyoutput directory recursively prior to writing daily JSON files, similar to howuser-datais handled.Implementation Details