build: make dev/build scripts portable and self-documenting - #1030
Draft
notluquis wants to merge 2 commits into
Draft
build: make dev/build scripts portable and self-documenting#1030notluquis wants to merge 2 commits into
notluquis wants to merge 2 commits into
Conversation
scripts/rm.js relies on fs.globSync, which only exists on Node 22 and newer, but nothing in the manifest advertised that floor, so a contributor on an older Node would only find out when a script threw. Declaring engines.node >=22 makes the requirement explicit up front. buildutil.js parses its flags with node:util parseArgs in strict mode but never registered a help option, so the documented "--help" invocation died with ERR_PARSE_ARGS instead of printing anything. The usage text already lived in a comment; promoting it to a string and wiring a help flag lets the script explain itself again. copyassets.js in watch mode rebuilt once per raw fs.watch event, and a single editor save emits several, so assets were copied repeatedly for one change. A short trailing debounce collapses the burst into one rebuild. The neighbouring comment also claimed recursive fs.watch works on Linux from Node 19, but that landed in Node 20, so it is corrected. Checked this with Claude Code: --help prints the usage text and exits 0, --check-version-match still parses without throwing, and the vitest and tsc suites stay green.
notluquis
marked this pull request as draft
July 7, 2026 17:25
5 tasks
notluquis
marked this pull request as ready for review
July 26, 2026 17:28
notluquis
marked this pull request as draft
August 3, 2026 00:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1026.
Three small portability fixes to the build and dev scripts.
engines floor.
scripts/rm.jsusesfs.globSync, which only exists on Node 22+, but the manifest never declared that floor. Added"engines": { "node": ">=22" }so the requirement is explicit rather than surfacing as a runtime throw on an older Node.buildutil.js --help. The script parses flags with
parseArgsfromnode:utilin strict mode but never registered ahelpoption, so the documented--helpinvocation threwERR_PARSE_ARGS. The usage text already existed as a comment; it is now ausagestring printed when--helpis passed. Existing flag handling is unchanged.copyassets.js watch debounce. In watch mode the script rebuilt once per raw
fs.watchevent, and a single save emits several, so assets were copied multiple times per change. A 100ms trailing debounce collapses the burst into one rebuild. The adjacent comment also said recursivefs.watchworks on Linux from Node 19; it actually landed in Node 20, so that is corrected.Verified:
node scripts/buildutil.js --helpprints the usage and exits 0,--check-version-matchstill parses without throwing,yarn vitest runandyarn tsc --noEmitare green, and prettier is clean on the touched files. I built and verified these with Claude Code.AI usage