Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use tsx instead of ts-node-esm #5104

Conversation

aloisklink
Copy link
Member

@aloisklink aloisklink commented Dec 4, 2023

📑 Summary

Replace ts-node with tsx.

ts-node-esm v10.9.1 is not compatible with Node.JS v18.19.0, see TypeStrong/ts-node#2094

This 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 because tsx 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 with tsx (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:

pnpm run build:vite
pnpm run dev # and testing if http://localhost:9000/ works
pnpm run lint:fix
pnpm run lint:jison
pnpm run contributors # FAILED, scripts/updateContributors.ts does not exist
pnpm run --filter mermaid docs:build
pnpm run --filter mermaid docs:verify
pnpm run --filter mermaid docs:pre:vitepress
pnpm run --filter mermaid docs:dev
pnpm run --filter mermaid docs:release-version
pnpm run --filter mermaid docs:verify-version
pnpm run --filter mermaid types:build-config
pnpm run --filter mermaid types:verify-config

📋 Tasks

Make sure you

`ts-node-esm` v10.9.1 is not compatible with Node.JS v18.19.0.
Copy link

netlify bot commented Dec 4, 2023

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit 4a7e4a3
🔍 Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/656dc1f8f1c15600083b6c06
😎 Deploy Preview https://deploy-preview-5104--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the Type: Other Not an enhancement or a bug label Dec 4, 2023
Copy link

codecov bot commented Dec 4, 2023

Codecov Report

Merging #5104 (4a7e4a3) into develop (6a31ae6) will increase coverage by 36.34%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##           develop    #5104       +/-   ##
============================================
+ Coverage    43.03%   79.37%   +36.34%     
============================================
  Files           23      166      +143     
  Lines         5017    13876     +8859     
  Branches        21      705      +684     
============================================
+ Hits          2159    11014     +8855     
+ Misses        2857     2710      -147     
- Partials         1      152      +151     
Flag Coverage Δ
e2e 85.18% <ø> (?)
unit 43.03% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 161 files with indirect coverage changes

@sidharthv96 sidharthv96 added this pull request to the merge queue Dec 4, 2023
Merged via the queue into mermaid-js:develop with commit 5d56835 Dec 4, 2023
18 checks passed
@aloisklink aloisklink deleted the chore/use-tsx-instead-of-ts-node-esm branch December 4, 2023 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: DevOps Type: Other Not an enhancement or a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants