feat: upgrade to Node 24 and modernize build toolchain#1
Conversation
Both packages dropped CJS require support in their major upgrades. Replace top-level require() calls with lazy dynamic import() for the @actions/github path (token-gated) and inline fs.promises.rename / fs.promises.rm for the @actions/io path so Jest's CJS environment can load and run the unauthenticated download test without --experimental-vm-modules. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@dcoraboeuf I am working on making updates to this and several of the other |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| if (!githubToken) { | ||
| throw "GitHub token must be provided in order to get the latest version of the CLI." | ||
| } | ||
| const github = await import('@actions/github'); |
There was a problem hiding this comment.
@rathpc , when launching the GH workflow on the PR, I get:
● downloading the CLI using the latest version
TypeError: A dynamic import callback was invoked without --experimental-vm-modules
90 | throw "GitHub token must be provided in order to get the latest version of the CLI."
91 | }
> 92 | const github = await import('@actions/github');
| ^
93 | const octokit = github.getOctokit(githubToken)
94 | const releases = await octokit.rest.repos.listReleases({
95 | owner: "nemerosa",
at downloadCLI (index.js:92:24)
at Object.downloadCLI [as install] (index.js:211:64)
at Object.install (index.test.js:21:44)
Can you have a look?
There was a problem hiding this comment.
@rathpc , I just saw your comment above :) So yes, it seems we need --experimental-vm-modules.
There was a problem hiding this comment.
Ok not a problem I will add that later today, thanks!
There was a problem hiding this comment.
@dcoraboeuf updated, please try running the workflow again. Thank you!
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@dcoraboeuf Would you be able to grant my user It would let the |
|
@rathpc , the PR build passes now. I'll merge and also grant you read-only access to the packages of this repo. |
|
Available in v2.0.0 |
|
@rathpc , I've granted you a Read role on this repository. It should grant you the read-access to the packages. Can you confirm everything is alright? And big thanks for the contribution ❤️ |
Summary
Upgrade
module-installto Node 24, ESLint 10, latest@actions/*packages, andsemantic-release25. Adds floating major/minor tag flow so consumers can pin to@v2and ride patch updates.What changed
engines.nodeset to>=24; CI workflow now installs Node 24@actions/github6.0.1 → 9.1.1 (now pure-ESM; consumed via dynamicawait import()since this library publishes as CJS)@actions/io2.0.0 → dropped entirely (replaced with nativefs.promises.renameandfs.promises.rm; the v3 ESM package was overkill for the actual use)eslint9 → 10 (ESLint 10 flat config; droppedFlatCompat)@eslint/jscompanion pinned to^10.0.1(latest published — versioned independently fromeslint)jest30.2 → 30.3semantic-release19 → 25@semantic-release/*plugins refreshed;@semantic-release/npmnow an explicit devDepGITHUB_TOKEN/YONTRACK_*env vars are absent (instead of throwing). PR CI without secrets passes. The unauthenticated fixed-version download test still runs.BREAKING CHANGE:footer always forces major.vXandvX.Ytags after each release, mirroring howactions/checkoutetc. publish themselves.actions/checkout@v4→@v6.actions/setup-node@v6(already current).CLAUDE.md.Why this is breaking
engines.node >= 24and the CI runner switching to Node 24 mean self-hosted runners on older Node will fail. GitHub-hosted runners support Node 24 natively. Hence theBREAKING CHANGE:footer in the squash-merge commit, whichsemantic-releasewill use to bump the published package to2.0.0.Test plan
secrets.GITHUB_TOKENavailable so the latest-version test runs too)mainbuild runssemantic-releaseand publishes2.0.0to GH Packagesv2andv2.0exist and point at the new release SHACHANGELOG.mdreflects the breaking changeKnown follow-up risk
The token-gated test
downloading the CLI using the latest versionexercisesawait import('@actions/github')(since v9 is pure ESM). Modern Jest 30 + Node 24 should handle dynamic ESM imports natively, but if CI surfaces an issue, the fix is to add--experimental-vm-modulesto thenpm testinvocation in.github/workflows/build.yml. Not addressed proactively since it's easy to fix in a follow-up commit if needed.Squash-merge commit message
When merging, please use this exact commit body: