chore(argent): declare the Node version the package actually needs - #653
Open
filip131311 wants to merge 2 commits into
Open
chore(argent): declare the Node version the package actually needs#653filip131311 wants to merge 2 commits into
filip131311 wants to merge 2 commits into
Conversation
Without an `engines` constraint npm cannot say anything when the installed Node is too old, so an unsupported runtime surfaces as a crash during a command rather than a message at install time. The floor is 20.12.0, which is where the published bundles actually start working — not the 20.0 that the first-party sources alone would suggest. The shipped artifacts inline their dependencies, and two of those inlined imports set the real floor: `styleText` is a static named import from `node:util`, which is a link-time failure below 20.12 and takes the installer and every CLI subcommand with it, and `import.meta.dirname` is evaluated at module scope, which is a TypeError below 20.11. That is also the lowest line CI exercises, and it is satisfied by every runtime dependency's own constraint. The README said 20.11, one minor below where the package can load, and CONTRIBUTING said 18, which predates what the repo's own lint toolchain needs. Fixes #640
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.
Fixes #640.
Why 20.12.0 and not 20
My first answer was
>=20— CI's lowest tested line, satisfied by every runtime dependency, and theversion the issue reporter (and I) installed successfully. It is wrong, and shipping it would
have told npm it is safe to install onto runtimes where the CLI cannot execute a single line.
The mistake was looking at first-party
src/. The published artifacts are four esbuild bundles withtheir dependencies inlined, and that is where the real floor lives. Confirmed in
packages/argent/dist/:import { styleText } from "node:util"(via inlined@clack/*, ininstaller.mjsandcli-cmds.mjs)SyntaxError—argent initand every CLI subcommand fail to loadimport.meta.dirnameat module scope (bundled-paths.js,cli.js)TypeErrorduring module initSo 20.12.0 is the lowest version on which the package actually loads. It is also the lowest line CI
exercises (7 workflows pin Node 20), and it satisfies every runtime dependency's own constraint
(
@fails-components/webtransport>=20,@modelcontextprotocol/sdk>=18).electron's>=22.12.0does not apply — it is anoptionalDependency, and npm does notengine-check those. Verified: installing
0.18.0on Node 20.19.5 produces noEBADENGINEat all andelectron is never materialized.
I did not go to
>=22on EOL grounds: it would refuse a runtime seven CI workflows still test andthat users demonstrably run.
Docs corrected alongside
README.mdsaid 20.11 — one minor below where the package can load.CONTRIBUTING.mdsaid Node.js 18+ — predates what the repo's own lint toolchain needs(
eslint@10requires^20.19.0 || ^22.13.0 || >=24).packages/argent/README.mdis generated byscripts/sync-readme.cjsonprepack, so it followsautomatically and is deliberately untouched.
What a reviewer should know
Enforcement is package-manager-dependent, which matters because
argent initinstalls withwhichever PM the project uses:
npm warn EBADENGINE— installs anywayengine-strict=trueSo this achieves the issue's "warn" but only conditionally its "refuse". There is no
.npmrcin therepo, so contributors are unaffected either way.
Nothing in the repo validates
engines—repo-hygiene,check-workspace-versions.mjsandpack-mcp.cjsall ignore unknown manifest keys, andnext-canary-version.mjsround-trips themanifest through
JSON.parse/stringify, which preserves the new field and stays prettier-clean.One inconsistency I did not resolve:
packages/argent/scripts/bundle-tools.cjs:383builds withtarget: "node22", which now sits above the declared floor. In practice the node20→node22 syntax gapis negligible (tsc targets ES2022 and I found no post-20 syntax), so I left the shipped artifact
alone rather than change build output in a manifest-only PR — but it should either be lowered to
match or consciously kept. Your call.
Separate bug found while verifying this
ios-remoteis broken on the entire Node 20 line, independent of this change: the inlined@moq/*client usesPromise.withResolvers(Node 22+) ungated — 6 occurrences indist/tool-server.cjs, reached fromutils/moq-client.tsvia the simulator-server blueprint.Reproduced on Node 20.19.5:
TypeError: Promise.withResolvers is not a function.I deliberately did not raise the floor to
>=22to paper over it — that would refuse Node 20 forevery user to hide one broken path.
moq-client.tsalready has anensurePolyfill()that polyfillsWebSocket/WebTransport; this belongs there. Filed separately.🤖 Generated with Claude Code