Commit f2b3fb9
committed
scripts(walkthrough): migrate fs calls to async + Promise.allSettled
Replaces every sync fs primitive with the promise-based equivalent
from node:fs, except existsSync which stays sync per the fleet
guideline. Affected surfaces:
- Submodule check + meander setup (ensureMeander) is now async and
its caller in generate() awaits.
- sriForUrl + injectSri cache reads/writes use fs.promises.
- The big post-process loop is hoisted into a per-file async helper
that fans out across all .html entries under Promise.allSettled;
rejections collect into a composite error so one broken page
surfaces every failure alongside the successes' output.
- minifyEmittedAssets runs JS + CSS minification tasks in parallel
via Promise.allSettled, summing byte savings across results.
- SRI + CSP injection pass mirrors the post-process fan-out pattern.
- serve() is now async. Request handler is async too, using
fs.stat() instead of statSync — existsSync stays for the guideline
exception. 404s surface on stat failure.
- readSlug / readPartFilenames / loadDotEnv / printDeployReceipt /
doctor / deployValtown file-listing + upload loop all use
fs.promises. Callers await accordingly.
- unlinkSync path (via safeDeleteSync) becomes safeDelete; imports
drop the sync variant in favor of the async one.
Parallelism is pure-IO (reads/writes/copies) — the deploy upload loop
stays serial because its POST-fall-through-PUT logic relies on serial
ordering. No behavior changes to user-visible output (same files,
same HTML, same URLs).1 parent 82c5ba1 commit f2b3fb9
1 file changed
Lines changed: 174 additions & 101 deletions
0 commit comments