Skip to content

Migrate to ESM and upgrade dependencies#1078

Merged
gdams merged 4 commits into
actions:mainfrom
priyagupta108:esm-and-dependency-upgrades
Jul 8, 2026
Merged

Migrate to ESM and upgrade dependencies#1078
gdams merged 4 commits into
actions:mainfrom
priyagupta108:esm-and-dependency-upgrades

Conversation

@priyagupta108

Copy link
Copy Markdown
Contributor

Description:
Convert to ESM, update imports/tests/configs for ESM, and bump dependencies.

Related issue:
Add link to the related issue.

Check list:

  • Ran npm run check locally (format, lint, build, test) and all checks pass.
  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

Copilot AI review requested due to automatic review settings July 8, 2026 06:55
@priyagupta108 priyagupta108 requested a review from a team as a code owner July 8, 2026 06:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 actions/setup-java to ESM (to support newer @actions/* packages), updates the TypeScript/Jest/ESLint/Prettier configuration accordingly, and bumps dependencies with an accompanying major-version release note.

Changes:

  • Switch TypeScript output and internal imports to ESM-friendly NodeNext + explicit .js specifiers.
  • Replace legacy Jest/ESLint/Prettier configs with ESM/flat-config equivalents and update tests for ESM mocking.
  • Bump dependencies (including @actions/*) and update Licensed metadata; bump package version to 6.0.0 with README breaking-change note.

Reviewed changes

Copilot reviewed 86 out of 96 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tsconfig.json Moves TS compilation settings toward ESM (ES2022 + NodeNext) and adjusts excludes.
src/util.ts Updates local imports to ESM-style .js specifiers.
src/toolchains.ts Updates local imports to ESM-style .js specifiers.
src/setup-java.ts Updates imports for ESM and replaces __dirname usage with import.meta.url-based pathing.
src/maven-args.ts Updates local imports to ESM-style .js specifiers.
src/gpg.ts Updates util import for ESM and adjusts ExecOptions import path.
src/distributions/zulu/installer.ts Updates internal imports to ESM-style .js specifiers.
src/distributions/temurin/installer.ts Updates internal imports to ESM-style .js specifiers and improves thrown errors with cause.
src/distributions/semeru/installer.ts Updates internal imports to ESM-style .js specifiers.
src/distributions/sapmachine/installer.ts Updates internal imports to ESM-style .js specifiers.
src/distributions/oracle/installer.ts Updates internal imports to ESM-style .js specifiers and adds models import needed for ESM.
src/distributions/microsoft/installer.ts Updates internal imports/exports to ESM-style .js specifiers and improves thrown errors with cause.
src/distributions/local/installer.ts Updates internal imports to ESM-style .js specifiers.
src/distributions/liberica/installer.ts Updates internal imports to ESM-style .js specifiers.
src/distributions/kona/installer.ts Updates internal imports to ESM-style .js specifiers.
src/distributions/jetbrains/installer.ts Updates internal imports to ESM-style .js specifiers.
src/distributions/graalvm/installer.ts Updates internal imports to ESM-style .js specifiers and improves thrown errors with cause.
src/distributions/dragonwell/installer.ts Updates internal imports to ESM-style .js specifiers.
src/distributions/distribution-factory.ts Updates distribution factory imports to ESM-style .js specifiers.
src/distributions/corretto/installer.ts Updates internal imports to ESM-style .js specifiers.
src/distributions/base-installer.ts Updates internal imports to ESM-style .js specifiers.
src/distributions/adopt/installer.ts Updates internal imports to ESM-style .js specifiers.
src/cleanup-java.ts Converts cleanup entrypoint to ESM and updates main-module detection logic (needs a robustness tweak).
src/auth.ts Updates internal imports to ESM-style .js specifiers.
README.md Documents breaking change for v6: migration to ESM.
package.json Bumps to 6.0.0, sets "type": "module", updates scripts for ESM Jest, and upgrades dependencies.
jest.config.ts Introduces TS-based ESM Jest configuration (ts-jest useESM).
jest.config.js Removes legacy CJS Jest config.
eslint.config.mjs Adds ESLint flat config for TS + Jest in an ESM-compatible format.
dist/setup/package.json Marks dist/setup package as ESM (type: module).
dist/cleanup/package.json Marks dist/cleanup package as ESM (type: module).
.prettierrc.json Replaces JS Prettier config with JSON config compatible with ESM setup.
.prettierrc.js Removes legacy JS Prettier config.
.licenses/npm/strnum.dep.yml Updates Licensed record for strnum version bump.
.licenses/npm/semver.dep.yml Updates Licensed record for semver version bump.
.licenses/npm/semver-6.3.1.dep.yml Removes old Licensed record for legacy semver version.
.licenses/npm/path-expression-matcher.dep.yml Updates Licensed record for path-expression-matcher version bump.
.licenses/npm/minimatch-3.1.5.dep.yml Adds/updates Licensed record for minimatch@3.1.5.
.licenses/npm/minimatch-10.2.5.dep.yml Adds Licensed record for minimatch@10.2.5 (Blue Oak license).
.licenses/npm/js-yaml.dep.yml Updates Licensed record for js-yaml version bump.
.licenses/npm/is-unsafe.dep.yml Updates Licensed record content to match the new dependency (is-unsafe).
.licenses/npm/fast-xml-parser.dep.yml Updates Licensed record for fast-xml-parser version bump.
.licenses/npm/fast-xml-builder.dep.yml Updates Licensed record for fast-xml-builder version bump.
.licenses/npm/brace-expansion-5.0.7.dep.yml Adds Licensed record for brace-expansion@5.0.7.
.licenses/npm/brace-expansion-1.1.15.dep.yml Updates Licensed record for brace-expansion 1.x version bump.
.licenses/npm/balanced-match-4.0.4.dep.yml Adds Licensed record for balanced-match@4.0.4.
.licenses/npm/balanced-match-1.0.2.dep.yml Adds Licensed record for balanced-match@1.0.2.
.licenses/npm/anynum.dep.yml Updates Licensed record for anynum version bump.
.licenses/npm/@typespec/ts-http-runtime.dep.yml Updates Licensed record for @typespec/ts-http-runtime version bump.
.licenses/npm/@azure/storage-common.dep.yml Updates Licensed record for @azure/storage-common version bump.
.licenses/npm/@azure/storage-blob.dep.yml Updates Licensed record for @azure/storage-blob version bump.
.licenses/npm/@azure/core-xml.dep.yml Updates Licensed record for @azure/core-xml version bump.
.licenses/npm/@azure/core-rest-pipeline.dep.yml Updates Licensed record for @azure/core-rest-pipeline version bump.
.licenses/npm/@azure/core-http-compat.dep.yml Updates Licensed record for @azure/core-http-compat version bump.
.licenses/npm/@azure/core-client.dep.yml Updates Licensed record for @azure/core-client version bump.
.licenses/npm/@azure/abort-controller.dep.yml Adds Licensed record for @azure/abort-controller@2.1.2.
.licenses/npm/@actions/tool-cache.dep.yml Updates Licensed record for @actions/tool-cache version bump.
.licenses/npm/@actions/io.dep.yml Updates Licensed record for @actions/io version bump.
.licenses/npm/@actions/http-client.dep.yml Updates Licensed record for @actions/http-client version bump.
.licenses/npm/@actions/glob-0.7.0.dep.yml Adds Licensed record for @actions/glob@0.7.0.
.licenses/npm/@actions/glob-0.6.1.dep.yml Updates Licensed record for @actions/glob prior version metadata.
.licenses/npm/@actions/exec.dep.yml Updates Licensed record for @actions/exec version bump.
.licenses/npm/@actions/core.dep.yml Updates Licensed record for @actions/core version bump.
.licenses/npm/@actions/cache.dep.yml Updates Licensed record for @actions/cache version bump.
.licensed.yml Updates allowed/reviewed licenses list for new transitive licenses.
.eslintrc.js Removes legacy ESLint config in favor of flat config.
.eslintignore Removes legacy ignore file (handled via flat-config ignores).
tests/util.test.ts Refactors tests for ESM + jest.unstable_mockModule usage.
tests/toolchains.test.ts Refactors tests for ESM + dynamic imports after mocking.
tests/maven-args.test.ts Refactors core mocking pattern for ESM.
tests/gpg.test.ts Refactors tests for ESM + dynamic imports after mocking.
tests/distributors/zulu-windows-installer.test.ts Refactors to ESM mocking and JSON import attributes.
tests/distributors/zulu-linux-installer.test.ts Refactors to ESM mocking and JSON import attributes.
tests/distributors/zulu-installer.test.ts Refactors to ESM mocking and JSON import attributes.
tests/distributors/temurin-installer.test.ts Refactors to ESM mocking and JSON import attributes.
tests/distributors/semeru-installer.test.ts Refactors to ESM mocking and JSON import attributes.
tests/distributors/sapmachine-installer.test.ts Refactors to ESM mocking and JSON import attributes.
tests/distributors/oracle-installer.test.ts Refactors to ESM mocking and dynamic imports after mocking.
tests/distributors/microsoft-installer.test.ts Refactors to ESM mocking (including os/fs module mocking) and JSON import attributes.
tests/distributors/local-installer.test.ts Refactors to ESM mocking and dynamic imports after mocking.
tests/distributors/liberica-windows-installer.test.ts Refactors to ESM mocking and JSON import attributes.
tests/distributors/liberica-linux-installer.test.ts Refactors to ESM mocking and JSON import attributes.
tests/distributors/liberica-installer.test.ts Refactors to ESM mocking and JSON import attributes.
tests/distributors/kona-installer.test.ts Updates source import path for ESM; JSON import style needs alignment with the rest of the ESM test suite.
tests/distributors/jetbrains-installer.test.ts Refactors to ESM mocking and JSON import attributes.
tests/distributors/graalvm-installer.test.ts Major refactor to ESM mocking patterns and dynamic imports.
tests/distributors/dragonwell-installer.test.ts Refactors to ESM mocking and JSON import attributes.
tests/distributors/corretto-installer.test.ts Refactors to ESM mocking and JSON import attributes.
tests/distributors/base-installer.test.ts Refactors to ESM mocking and dynamic imports after mocking.
tests/distributors/adopt-installer.test.ts Refactors to ESM mocking and JSON import attributes.
tests/cleanup-java.test.ts Refactors cleanup tests to ESM mocking and dynamic imports after mocking.
tests/cache.test.ts Refactors cache tests to ESM mocking and dynamic imports after mocking.
tests/auth.test.ts Refactors auth tests to ESM mocking and dynamic imports after mocking.
Comments suppressed due to low confidence (1)

src/cleanup-java.ts:60

  • The ESM main-module check is brittle: process.argv[1] can be a relative path (e.g. node dist/cleanup/index.js) or differ by path normalization/symlinks, causing run() to be skipped even when this file is the entrypoint. Consider normalizing both sides (e.g., resolve process.argv[1] to an absolute path and compare to fileURLToPath(import.meta.url), or compare file URLs via pathToFileURL(path.resolve(process.argv[1]))).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread __tests__/distributors/kona-installer.test.ts Outdated
@priyagupta108 priyagupta108 force-pushed the esm-and-dependency-upgrades branch from 471d5f5 to 5dd9627 Compare July 8, 2026 07:15
gdams
gdams previously approved these changes Jul 8, 2026
@gdams gdams merged commit f712137 into actions:main Jul 8, 2026
405 checks passed
@priyagupta108 priyagupta108 self-assigned this Jul 8, 2026
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.

4 participants