Skip to content

Migrate to ESM and upgrade dependencies#1574

Open
gowridurgad wants to merge 2 commits into
actions:mainfrom
gowridurgad:esm-migration-node
Open

Migrate to ESM and upgrade dependencies#1574
gowridurgad wants to merge 2 commits into
actions:mainfrom
gowridurgad:esm-migration-node

Conversation

@gowridurgad

Copy link
Copy Markdown
Contributor

Description:
Migrates setup-node from CommonJS to ECMAScript Modules (ESM)

Related issue:
Add link to the related issue.

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

@gowridurgad gowridurgad requested a review from a team as a code owner June 26, 2026 08:33
Copilot AI review requested due to automatic review settings June 26, 2026 08:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: NodeNext and update internal relative imports to include .js extensions.
  • 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 licensed metadata 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.

Comment thread package.json Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants