fix: replace ts-node-dev with tsx to unbreak dev scripts - #51
Merged
Conversation
The typescript 5.9.3 -> 7.0.2 bump (#46) broke every ts-node-dev script: TypeError: Cannot read properties of undefined (reading 'fileExists') at readConfig (ts-node/dist/configuration.js:91:33) typescript@7 is the native/Go compiler port. Its npm package exports only 2 keys and `ts.sys` is undefined, so ts-node@10.9.2 dies reaching for `ts.sys.fileExists` at startup. This hit `dev`, `discord:debug`, `discourse:debug`, and `models:list` — everything except `build` (tsc CLI) and `test` (vitest transpiles with esbuild). ts-node-dev is also unmaintained, so there is no upstream fix coming. Swap it for tsx, which uses esbuild and never touches the TS compiler API. `--transpile-only` is dropped because tsx never type-checks; `npm run build` remains the type-check gate. `dev` is plain `tsx src/main.ts`, deliberately NOT `tsx watch`: main.ts is a one-shot job that posts to Slack, so re-running it on every file save is wrong. The old `--respawn` was a latent footgun. Also drop the now-dangling `diff` override. It existed only to pin ts-node-dev's vulnerable transitive `diff`; `npm ls diff` is empty now. Net 201 packages removed from the lockfile. Verified: `npm run models:list` and `npm run discourse:debug` both complete against live APIs, `npm run build` clean, 108/108 tests pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Why
The
typescript5.9.3 → 7.0.2 bump (#46) broke everyts-node-devscript:typescript@7is the native/Go compiler port. Its npm package exports 2 keys total andts.sysisundefined:ts-node@10.9.2reaches forts.sys.fileExistsat startup, so it dies immediately. This took outdev,discord:debug,discourse:debug, andmodels:list— everything exceptbuild(thetscCLI) andtest(vitest transpiles with esbuild).ts-node-devis unmaintained, so no upstream fix is coming.What changed
ts-node-dev→tsx(esbuild-based, never touches the TS compiler API).--transpile-onlyis dropped since tsx never type-checks;npm run buildremains the type-check gate.devis plaintsx src/main.ts, deliberately nottsx watch.main.tsis a one-shot job that posts to Slack — re-running it on every file save is wrong. The old--respawnwas a latent footgun.diffoverride. It existed only to pints-node-dev's vulnerable transitivediff;npm ls diffis empty now. Theundicioverride is untouched.pnpm-lock.yamlfrom a local experiment.package-lock.jsonis the committed lockfile and whatnpm ciindaily-digest.ymlconsumes.AGENTS.mdcommand list updated to match.Net 201 packages removed from the lockfile (tsx's tree is much smaller than ts-node-dev's).
Verification
I ran the two read-only debug tools rather than
npm run dev, since that fires a real digest.Reviewer notes
npm installnow warns thatesbuild@0.28.1has an unapproved postinstall script (npm'sallow-scriptsgate). tsx works regardless in local testing, but CI may neednpm approve-scripts esbuildifnpm cirefuses it. Worth watching on the first run.🤖 Generated with Claude Code