-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Pin Node.JS version in GitHub Actions/Netlify to v18.18.2 using NVM (removes volta) #5097
Pin Node.JS version in GitHub Actions/Netlify to v18.18.2 using NVM (removes volta) #5097
Conversation
nvm has better compatibility with GitHub Actions and Netlify.
I've excluded other CI files since they use a build matrix (even if just a single value), so it's not as easy to use replace with this `.nvmrc` file.
Node v18.19.0 breaks `ts-node-esm`, so `pnpm install` won't work. See: TypeStrong/ts-node#2094
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #5097 +/- ##
========================================
Coverage 79.38% 79.38%
========================================
Files 166 166
Lines 13871 13871
Branches 705 705
========================================
Hits 11012 11012
Misses 2707 2707
Partials 152 152
Flags with carried forward coverage won't be shown. Click here to find out more. |
It looks like we can't merge this, since GitHub expects the CI runs to be called Maybe instead of using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use pnpm itself to manage node? https://pnpm.io/cli/env
That would mean one less tool.
Netlify is currently working as I set the NODE_VERSION environment variable in netlify.
Yep, we could, but then what tool would we use to manage Line 7 in 798f9f8
It's also not as nice as just using the following in GitHub Actions: - name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: pnpm
node-version-file: '.nvmrc'
🚀 Awesome! In that case, this PR isn't urgent (yet). Maybe a better way of fixing this issue would be to switch to using https://www.npmjs.com/package/tsx instead of |
I remember having some problems after switching to tsx. Don't recall the exact issue. Maybe it's fixed now. |
I've made a PR for replacing |
📑 Summary
Pin our Node.JS version to v18.18.2 using NVM.
This is important as our Netlify builds have recently stopped working, see https://app.netlify.com/sites/mermaid-js/deploys/656b6ffb3872da00082fda6f.
This is because Node.JS v18.19.0 came out on 2023-11-29 and Netlify recently switched to using it. This version of Node.JS is incompatible with
ts-node-esm
, which is used for our build script, see TypeStrong/ts-node#2094.Because of this, we need to tell Netlify to use Node.JS v18.18.2, which can be done by setting a
.nvmrc
file, see https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript.I've also told GitHub Actions to use Node.JS v18.18.2, since although they're still cached on that version, they'll soon upgrade to v18.19.0.
📏 Design Decisions
Why am I switching from
volta
tonvm
Currently, we're using volta to manage our Node.JS version. Unfortunately, Volta isn't as compatible with CI (netlify/GitHub Actions), so I've moved to NVM.
netlify build log error
For posterity, the error message from netlify's build logs is:
📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.develop
branch