Skip to content

build: make dev/build scripts portable and self-documenting - #1030

Draft
notluquis wants to merge 2 commits into
jupyterlab:masterfrom
notluquis:fix/build-script-portability
Draft

build: make dev/build scripts portable and self-documenting#1030
notluquis wants to merge 2 commits into
jupyterlab:masterfrom
notluquis:fix/build-script-portability

Conversation

@notluquis

@notluquis notluquis commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Closes #1026.

Three small portability fixes to the build and dev scripts.

engines floor. scripts/rm.js uses fs.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 parseArgs from node:util in strict mode but never registered a help option, so the documented --help invocation threw ERR_PARSE_ARGS. The usage text already existed as a comment; it is now a usage string printed when --help is passed. Existing flag handling is unchanged.

copyassets.js watch debounce. In watch mode the script rebuilt once per raw fs.watch event, 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 recursive fs.watch works on Linux from Node 19; it actually landed in Node 20, so that is corrected.

Verified: node scripts/buildutil.js --help prints the usage and exits 0, --check-version-match still parses without throwing, yarn vitest run and yarn tsc --noEmit are green, and prettier is clean on the touched files. I built and verified these with Claude Code.

AI usage

  • YES: Some or all of the content of this PR was generated by AI.
  • : The human author has carefully reviewed this PR and run this code (keep this PR "draft" until the answer is YES)
  • AI tools and models used: Claude Code

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 notluquis self-assigned this Jul 7, 2026
@notluquis
notluquis marked this pull request as draft July 7, 2026 17:25
@notluquis notluquis added this to the Future milestone Jul 7, 2026
@notluquis
notluquis marked this pull request as ready for review July 26, 2026 17:28
@notluquis
notluquis requested a review from krassowski July 26, 2026 18:06
@notluquis
notluquis marked this pull request as draft August 3, 2026 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build and dev script portability

1 participant