chore: replace ts-node with tsx for running TypeScript#9635
chore: replace ts-node with tsx for running TypeScript#9635nazarhussain wants to merge 2 commits into
Conversation
Motivation: - ts-node was pinned to a pre-release (^11.0.0-beta.1) and depended on the deprecated Node `--loader` hook plus an RC TypeScript, making it fragile to maintain on Node 24 (engines ^24.13.0). - tsx is actively maintained, esbuild-based (faster startup, transpile-only by default), integrates via the current `--import` hook, and is the runner recommended in the official Node.js TypeScript docs. - Simplifies config: removes the `ts-node` blocks from tsconfig and the deprecated `--loader ts-node/esm` invocations. Changes: - devDependency ts-node@^11 -> tsx@^4.23.0 - `pnpm exec ts-node X.ts` -> `pnpm exec tsx X.ts` (check-readme in 15 pkgs) - `node --loader[=]ts-node/esm X.ts` -> `node --import tsx X.ts` (download-spec-tests, cli docs:build + test:sim:*, benchmark:files, run_e2e_env.sh, params e2e tests) - test-utils runWith option "ts-node" -> "tsx" - drop `ts-node` blocks from tsconfig.json / tsconfig.e2e.json - shebangs: check_readme.ts -> tsx; compiled bin downloadTestsCli.ts -> node - update usage comments referencing node_modules/.bin/ts-node Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request replaces ts-node with tsx across the entire monorepo to improve TypeScript execution and transpilation performance. This includes updating package scripts, dependencies, shebangs, test utility helpers, and removing ts-node configurations from tsconfig.json files. There are no review comments, so there is no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
The ts-node -> tsx swap re-anchored two CodeQL alerts on these lines: "Shell command built from environment values" (child.exec with an interpolated __dirname path). Replace child.exec with child.execFile passing args as an array, so no shell is spawned and the path is never string-interpolated. Also robust to checkout paths containing spaces. The rejection assertion still holds: promisified execFile appends stderr to the rejected error message. Verified all 4 params e2e tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Performance Report✔️ no performance regression detected Full benchmark results
|
Motivation
We were running our
.tsscripts (spec-test downloads, README checks, sim/e2e tests, docs generation, benchmarks) throughts-node, which had become a liability:ts-node@^11.0.0-beta.1, alongside an RC TypeScript. Not a combination we want in the toolchain long-term.--loaderhook (--loader ts-node/esm). Node has moved to--import, and--loaderprints deprecation warnings and is slated for removal.enginesis^24.13.0).tsxis the drop-in replacement recommended by the official Node.js TypeScript docs:--import tsxhook (no deprecated flags).Changes
ts-node@^11.0.0-beta.1→tsx@^4.23.0--loaderdeprecated →--import):pnpm exec ts-node X.ts→pnpm exec tsx X.ts(check-readmeacross 15 packages)node --loader[=]ts-node/esm X.ts→node --import tsx X.ts(download-spec-tests, clidocs:build+test:sim:*,benchmark:files,run_e2e_env.sh, params e2e tests)tsconfig.json/tsconfig.e2e.json: removed the"ts-node": { "transpileOnly": true }blocks (tsx is transpile-only by default) and refreshed the stale comment.test-utils/src/cli.ts:runWith?: "node" | "ts-node"→"node" | "tsx".scripts/check_readme.ts→tsx;packages/spec-test-util/src/downloadTestsCli.ts→node(it's the source for a compiled published bin, so its shebang must point tonode, not a TS runner — the oldts-nodeshebang was latent breakage).node_modules/.bin/ts-node.Validation
git grep ts-nodeacross the repo → no references remain;ts-nodegone frompnpm-lock.yamlandnode_modules.pnpm installclean;tsx v4.23.0onnode v24.13.0.check-readme(the most-used tsx path) runs end-to-end: after building@lodestar/config, all 5 README snippets validated.AI disclosure
This PR was prepared with AI assistance (Claude Code).
🤖 Generated with Claude Code