build: use tsx
instead of ts-node-esm
#5104
Merged
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.
📑 Summary
Replace
ts-node
withtsx
.ts-node-esm
v10.9.1 is not compatible with Node.JS v18.19.0, see TypeStrong/ts-node#2094This will be important very soon, since all of our GitHub Actions use the Node.JS version of
18.x
, and although they're all currently still using the cached 18.18.2 version of Node.JS, eventually they'll move to v18.19.0 and all of our GitHub Actions CI jobs will break.Closes #5097, since we won't need that change anymore.
📏 Design Decisions
Important: unlike
ts-node-esm
,tsx
does not do type-checking, e.g. it acts like the--transpileOnly
flag is always on. This is becausetsx
does not use typescript for transpilation, instead it uses esbuild.This is a potential issue, since I'm not sure if we're type-checking some of these scripts otherwise.
Previous work
We've tried replacing
ts-node
before withtsx
(see 7533728, reverted in 3677d44). My gut feeling is that it failed because we forgot to remove the--transpileOnly
flag. But it could also be that ESBuild was still a bit buggy back then.Testing
Since I'm not sure all the commands are tested in CI, I ran the following commands to test everything:
📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.develop
branch