Migrate to ESM and upgrade dependencies#1574
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the setup-node codebase and tooling from CommonJS to ESM, aligning runtime behavior (NodeNext resolution + import.meta.url) with updated dependencies and ESM-compatible lint/test configuration.
Changes:
- Switch TypeScript compilation to
module: NodeNextand update internal relative imports to include.jsextensions. - Migrate Jest and ESLint configuration to ESM-friendly setups (flat ESLint config + TS Jest config + ESM mocking patterns).
- Upgrade Actions/toolkit and related dependencies, and refresh
licensedmetadata accordingly.
Reviewed changes
Copilot reviewed 73 out of 85 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Switch TS module output to NodeNext and exclude jest config from compilation. |
| src/util.ts | Update catch clause style while keeping behavior unchanged. |
| src/setup-node.ts | Update entrypoint import to ESM-friendly .js specifier. |
| src/main.ts | Convert internal imports to .js and replace __dirname usage with import.meta.url resolution. |
| src/distributions/v8-canary/canary_builds.ts | Update internal imports to .js specifiers. |
| src/distributions/rc/rc_builds.ts | Update internal imports to .js specifiers. |
| src/distributions/official_builds/official_builds.ts | Update internal imports to .js specifiers. |
| src/distributions/nightly/nightly_builds.ts | Update internal imports to .js specifiers. |
| src/distributions/installer-factory.ts | Update internal imports to .js specifiers. |
| src/distributions/base-distribution.ts | Update imports for ESM and replace __dirname usage with import.meta.url resolution. |
| src/distributions/base-distribution-prerelease.ts | Update internal imports to .js specifiers. |
| src/cache-utils.ts | Update internal import to .js and fix async command output usage (await). |
| src/cache-save.ts | Update internal imports to .js specifiers. |
| src/cache-restore.ts | Update internal imports to .js specifiers. |
| package.json | Mark package as ESM, update scripts, and upgrade dependencies/tooling. |
| jest.config.ts | Add ESM-compatible Jest configuration using ts-jest with useESM. |
| jest.config.js | Remove legacy CommonJS Jest configuration. |
| eslint.config.mjs | Add flat ESLint config in ESM format. |
| dist/setup/package.json | Add package boundary metadata for the bundled setup entrypoint. |
| dist/cache-save/package.json | Add package boundary metadata for the bundled post-action entrypoint. |
| .prettierrc.json | Add Prettier configuration in JSON format. |
| .prettierrc.js | Remove legacy CommonJS Prettier configuration. |
| .licensed.yml | Update allowed/reviewed licenses and normalize indentation for reviewed packages. |
| .eslintrc.js | Remove legacy ESLint config (replaced by flat config). |
| .eslintignore | Remove legacy ignore file (handled via flat config ignores). |
| tests/rc-installer.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/problem-matcher.test.ts | Update tests to use ESM JSON import attributes and Jest globals. |
| tests/official-installer.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/nightly-installer.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/mock/glob-mock.test.ts | Update internal test import to .js specifier and Jest globals. |
| tests/main.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/canary-installer.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/cache-utils.test.ts | Update tests to mock @actions/exec.getExecOutput and align with async command execution. |
| tests/cache-save.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/cache-restore.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/authutil.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| .licenses/npm/xml-naming.dep.yml | Normalize license metadata formatting (homepage field). |
| .licenses/npm/wrappy.dep.yml | Remove license metadata entry (dependency resolution changed). |
| .licenses/npm/universal-user-agent.dep.yml | Update license metadata to match upgraded dependency version/content. |
| .licenses/npm/strnum.dep.yml | Update license metadata formatting/version alignment. |
| .licenses/npm/semver.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/semver-6.3.1.dep.yml | Remove old semver v6 license metadata entry. |
| .licenses/npm/once.dep.yml | Remove license metadata entry (dependency resolution changed). |
| .licenses/npm/minimatch-3.1.5.dep.yml | Add license metadata for additional minimatch version present in resolution. |
| .licenses/npm/minimatch-10.2.5.dep.yml | Add license metadata for upgraded minimatch version present in resolution. |
| .licenses/npm/json-with-bigint.dep.yml | Update license metadata to match dependency name/version/copyright. |
| .licenses/npm/fast-xml-parser.dep.yml | Update license metadata formatting/version alignment. |
| .licenses/npm/fast-content-type-parse.dep.yml | Update license metadata to match new dependency and reviewed status. |
| .licenses/npm/deprecation.dep.yml | Remove license metadata entry (dependency resolution changed). |
| .licenses/npm/brace-expansion-5.0.6.dep.yml | Update license metadata to match resolved dependency content. |
| .licenses/npm/brace-expansion-1.1.13.dep.yml | Add license metadata for additional brace-expansion version present in resolution. |
| .licenses/npm/before-after-hook.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/balanced-match-4.0.4.dep.yml | Add license metadata for additional balanced-match version present in resolution. |
| .licenses/npm/balanced-match-1.0.2.dep.yml | Add license metadata for additional balanced-match version present in resolution. |
| .licenses/npm/@typespec/ts-http-runtime.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/types.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/types-13.10.0.dep.yml | Remove old @octokit/types license metadata entry. |
| .licenses/npm/@octokit/request.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/request-error.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/plugin-rest-endpoint-methods.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/plugin-paginate-rest.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/openapi-types.dep.yml | Update license metadata to match upgraded dependency version/content. |
| .licenses/npm/@octokit/graphql.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/endpoint.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/core.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/auth-token.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@nodable/entities.dep.yml | Update license metadata formatting/version alignment. |
| .licenses/npm/@azure/storage-common.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@azure/storage-blob.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@azure/core-xml.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@azure/core-rest-pipeline.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@azure/core-http-compat.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@azure/abort-controller.dep.yml | Add license metadata for newly present dependency in resolution. |
| .licenses/npm/@actions/tool-cache.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@actions/io.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@actions/http-client-4.0.1.dep.yml | Update license metadata to match upgraded dependency version/content. |
| .licenses/npm/@actions/glob-0.7.0.dep.yml | Update license metadata to match upgraded dependency version/content. |
| .licenses/npm/@actions/glob-0.6.1.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@actions/github.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@actions/exec.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@actions/core.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@actions/cache.dep.yml | Update license metadata to match upgraded dependency version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
01bf383 to
0b42139
Compare
#11) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/setup-node](https://github.com/actions/setup-node) | action | major | `v6.4.0` → `v7.0.0` | --- ### Release Notes <details> <summary>actions/setup-node (actions/setup-node)</summary> ### [`v7.0.0`](https://github.com/actions/setup-node/releases/tag/v7.0.0) [Compare Source](actions/setup-node@v6.5.0...v7.0.0) #### What's Changed ##### Enhancements: - Add cache-primary-key and cache-matched-key as outputs by [@​gowridurgad](https://github.com/gowridurgad) in [#​1577](actions/setup-node#1577) - Migrate to ESM and upgrade dependencies by [@​gowridurgad](https://github.com/gowridurgad) in [#​1574](actions/setup-node#1574) ##### Bug fixes: - Remove dummy NODE\_AUTH\_TOKEN export by [@​gowridurgad](https://github.com/gowridurgad) in [#​1558](actions/setup-node#1558) - Only use `mirrorToken` in `getManifest` if it's provided by [@​deiga](https://github.com/deiga) in [#​1548](actions/setup-node#1548) ##### Documentation updates: - Add documentation for publishing to npm with Trusted Publisher (OIDC) by [@​chiranjib-swain](https://github.com/chiranjib-swain) in [#​1536](actions/setup-node#1536) - docs: Update restore-only cache documentation by [@​priya-kinthali](https://github.com/priya-kinthali) in [#​1550](actions/setup-node#1550) - docs: Update caching recommendations to mitigate cache poisoning risks by [@​chiranjib-swain](https://github.com/chiranjib-swain) in [#​1567](actions/setup-node#1567) ##### Dependency update: - Upgrade [@​actions/cache](https://github.com/actions/cache) to 5.1.0, log cache write denied by [@​jasongin](https://github.com/jasongin) in [#​1569](actions/setup-node#1569) #### New Contributors - [@​chiranjib-swain](https://github.com/chiranjib-swain) made their first contribution in [#​1536](actions/setup-node#1536) - [@​deiga](https://github.com/deiga) made their first contribution in [#​1548](actions/setup-node#1548) - [@​jasongin](https://github.com/jasongin) made their first contribution in [#​1569](actions/setup-node#1569) **Full Changelog**: <actions/setup-node@v6...v7.0.0> ### [`v6.5.0`](https://github.com/actions/setup-node/releases/tag/v6.5.0) [Compare Source](actions/setup-node@v6.4.0...v6.5.0) #### What's Changed - Update [@​actions/cache](https://github.com/actions/cache) to 5.1.0 and add security overrides for undici and fast-xml-parser by [@​HarithaVattikuti](https://github.com/HarithaVattikuti) in [#​1579](actions/setup-node#1579) **Full Changelog**: <actions/setup-node@v6.4.0...v6.5.0> </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/Warsaw) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNjEuMiIsInVwZGF0ZWRJblZlciI6IjQzLjI2MS4yIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=--> Reviewed-on: https://git.ajgon.casa/deedee/schemas/pulls/11
|
this got listed as breaking change in https://github.com/actions/setup-node#breaking-changes-in-v7 - any idea what is the proper way to check is it a breaking change in openstreetmap/id-tagging-schema#2555 and potentially mitigate it? https://github.com/actions/setup-node#breaking-changes-in-v7 does not have much info or migration steps |
Description:
Migrates setup-node from CommonJS to ECMAScript Modules (ESM)
Related issue:
Add link to the related issue.
Check list: