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.

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

CopilotAI 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
FileDescription
tsconfig.jsonMoves TS compilation settings toward ESM (ES2022 + NodeNext) and adjusts excludes.
src/util.tsUpdates local imports to ESM-style .js specifiers.
src/toolchains.tsUpdates local imports to ESM-style .js specifiers.
src/setup-java.tsUpdates imports for ESM and replaces __dirname usage with import.meta.url-based pathing.
src/maven-args.tsUpdates local imports to ESM-style .js specifiers.
src/gpg.tsUpdates util import for ESM and adjusts ExecOptions import path.
src/distributions/zulu/installer.tsUpdates internal imports to ESM-style .js specifiers.
src/distributions/temurin/installer.tsUpdates internal imports to ESM-style .js specifiers and improves thrown errors with cause.
src/distributions/semeru/installer.tsUpdates internal imports to ESM-style .js specifiers.
src/distributions/sapmachine/installer.tsUpdates internal imports to ESM-style .js specifiers.
src/distributions/oracle/installer.tsUpdates internal imports to ESM-style .js specifiers and adds models import needed for ESM.
src/distributions/microsoft/installer.tsUpdates internal imports/exports to ESM-style .js specifiers and improves thrown errors with cause.
src/distributions/local/installer.tsUpdates internal imports to ESM-style .js specifiers.
src/distributions/liberica/installer.tsUpdates internal imports to ESM-style .js specifiers.
src/distributions/kona/installer.tsUpdates internal imports to ESM-style .js specifiers.
src/distributions/jetbrains/installer.tsUpdates internal imports to ESM-style .js specifiers.
src/distributions/graalvm/installer.tsUpdates internal imports to ESM-style .js specifiers and improves thrown errors with cause.
src/distributions/dragonwell/installer.tsUpdates internal imports to ESM-style .js specifiers.
src/distributions/distribution-factory.tsUpdates distribution factory imports to ESM-style .js specifiers.
src/distributions/corretto/installer.tsUpdates internal imports to ESM-style .js specifiers.
src/distributions/base-installer.tsUpdates internal imports to ESM-style .js specifiers.
src/distributions/adopt/installer.tsUpdates internal imports to ESM-style .js specifiers.
src/cleanup-java.tsConverts cleanup entrypoint to ESM and updates main-module detection logic (needs a robustness tweak).
src/auth.tsUpdates internal imports to ESM-style .js specifiers.
README.mdDocuments breaking change for v6: migration to ESM.
package.jsonBumps to 6.0.0, sets "type": "module", updates scripts for ESM Jest, and upgrades dependencies.
jest.config.tsIntroduces TS-based ESM Jest configuration (ts-jest useESM).
jest.config.jsRemoves legacy CJS Jest config.
eslint.config.mjsAdds ESLint flat config for TS + Jest in an ESM-compatible format.
dist/setup/package.jsonMarks dist/setup package as ESM (type: module).
dist/cleanup/package.jsonMarks dist/cleanup package as ESM (type: module).
.prettierrc.jsonReplaces JS Prettier config with JSON config compatible with ESM setup.
.prettierrc.jsRemoves legacy JS Prettier config.
.licenses/npm/strnum.dep.ymlUpdates Licensed record for strnum version bump.
.licenses/npm/semver.dep.ymlUpdates Licensed record for semver version bump.
.licenses/npm/semver-6.3.1.dep.ymlRemoves old Licensed record for legacy semver version.
.licenses/npm/path-expression-matcher.dep.ymlUpdates Licensed record for path-expression-matcher version bump.
.licenses/npm/minimatch-3.1.5.dep.ymlAdds/updates Licensed record for minimatch@3.1.5.
.licenses/npm/minimatch-10.2.5.dep.ymlAdds Licensed record for minimatch@10.2.5 (Blue Oak license).
.licenses/npm/js-yaml.dep.ymlUpdates Licensed record for js-yaml version bump.
.licenses/npm/is-unsafe.dep.ymlUpdates Licensed record content to match the new dependency (is-unsafe).
.licenses/npm/fast-xml-parser.dep.ymlUpdates Licensed record for fast-xml-parser version bump.
.licenses/npm/fast-xml-builder.dep.ymlUpdates Licensed record for fast-xml-builder version bump.
.licenses/npm/brace-expansion-5.0.7.dep.ymlAdds Licensed record for brace-expansion@5.0.7.
.licenses/npm/brace-expansion-1.1.15.dep.ymlUpdates Licensed record for brace-expansion 1.x version bump.
.licenses/npm/balanced-match-4.0.4.dep.ymlAdds Licensed record for balanced-match@4.0.4.
.licenses/npm/balanced-match-1.0.2.dep.ymlAdds Licensed record for balanced-match@1.0.2.
.licenses/npm/anynum.dep.ymlUpdates Licensed record for anynum version bump.
.licenses/npm/@typespec/ts-http-runtime.dep.ymlUpdates Licensed record for @typespec/ts-http-runtime version bump.
.licenses/npm/@azure/storage-common.dep.ymlUpdates Licensed record for @azure/storage-common version bump.
.licenses/npm/@azure/storage-blob.dep.ymlUpdates Licensed record for @azure/storage-blob version bump.
.licenses/npm/@azure/core-xml.dep.ymlUpdates Licensed record for @azure/core-xml version bump.
.licenses/npm/@azure/core-rest-pipeline.dep.ymlUpdates Licensed record for @azure/core-rest-pipeline version bump.
.licenses/npm/@azure/core-http-compat.dep.ymlUpdates Licensed record for @azure/core-http-compat version bump.
.licenses/npm/@azure/core-client.dep.ymlUpdates Licensed record for @azure/core-client version bump.
.licenses/npm/@azure/abort-controller.dep.ymlAdds Licensed record for @azure/abort-controller@2.1.2.
.licenses/npm/@actions/tool-cache.dep.ymlUpdates Licensed record for @actions/tool-cache version bump.
.licenses/npm/@actions/io.dep.ymlUpdates Licensed record for @actions/io version bump.
.licenses/npm/@actions/http-client.dep.ymlUpdates Licensed record for @actions/http-client version bump.
.licenses/npm/@actions/glob-0.7.0.dep.ymlAdds Licensed record for @actions/glob@0.7.0.
.licenses/npm/@actions/glob-0.6.1.dep.ymlUpdates Licensed record for @actions/glob prior version metadata.
.licenses/npm/@actions/exec.dep.ymlUpdates Licensed record for @actions/exec version bump.
.licenses/npm/@actions/core.dep.ymlUpdates Licensed record for @actions/core version bump.
.licenses/npm/@actions/cache.dep.ymlUpdates Licensed record for @actions/cache version bump.
.licensed.ymlUpdates allowed/reviewed licenses list for new transitive licenses.
.eslintrc.jsRemoves legacy ESLint config in favor of flat config.
.eslintignoreRemoves legacy ignore file (handled via flat-config ignores).
tests/util.test.tsRefactors tests for ESM + jest.unstable_mockModule usage.
tests/toolchains.test.tsRefactors tests for ESM + dynamic imports after mocking.
tests/maven-args.test.tsRefactors core mocking pattern for ESM.
tests/gpg.test.tsRefactors tests for ESM + dynamic imports after mocking.
tests/distributors/zulu-windows-installer.test.tsRefactors to ESM mocking and JSON import attributes.
tests/distributors/zulu-linux-installer.test.tsRefactors to ESM mocking and JSON import attributes.
tests/distributors/zulu-installer.test.tsRefactors to ESM mocking and JSON import attributes.
tests/distributors/temurin-installer.test.tsRefactors to ESM mocking and JSON import attributes.
tests/distributors/semeru-installer.test.tsRefactors to ESM mocking and JSON import attributes.
tests/distributors/sapmachine-installer.test.tsRefactors to ESM mocking and JSON import attributes.
tests/distributors/oracle-installer.test.tsRefactors to ESM mocking and dynamic imports after mocking.
tests/distributors/microsoft-installer.test.tsRefactors to ESM mocking (including os/fs module mocking) and JSON import attributes.
tests/distributors/local-installer.test.tsRefactors to ESM mocking and dynamic imports after mocking.
tests/distributors/liberica-windows-installer.test.tsRefactors to ESM mocking and JSON import attributes.
tests/distributors/liberica-linux-installer.test.tsRefactors to ESM mocking and JSON import attributes.
tests/distributors/liberica-installer.test.tsRefactors to ESM mocking and JSON import attributes.
tests/distributors/kona-installer.test.tsUpdates source import path for ESM; JSON import style needs alignment with the rest of the ESM test suite.
tests/distributors/jetbrains-installer.test.tsRefactors to ESM mocking and JSON import attributes.
tests/distributors/graalvm-installer.test.tsMajor refactor to ESM mocking patterns and dynamic imports.
tests/distributors/dragonwell-installer.test.tsRefactors to ESM mocking and JSON import attributes.
tests/distributors/corretto-installer.test.tsRefactors to ESM mocking and JSON import attributes.
tests/distributors/base-installer.test.tsRefactors to ESM mocking and dynamic imports after mocking.
tests/distributors/adopt-installer.test.tsRefactors to ESM mocking and JSON import attributes.
tests/cleanup-java.test.tsRefactors cleanup tests to ESM mocking and dynamic imports after mocking.
tests/cache.test.tsRefactors cache tests to ESM mocking and dynamic imports after mocking.
tests/auth.test.tsRefactors 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
priyagupta108force-pushed the esm-and-dependency-upgrades branch from 471d5f5 to 5dd9627CompareJuly 8, 2026 07:15
gdams
gdams previously approved these changes Jul 8, 2026
@gdams
gdams merged commit f712137 into actions:mainJul 8, 2026
405 checks passed
@priyagupta108priyagupta108 self-assigned this Jul 8, 2026
zendesk-ops-ci pushed a commit to zendesk/setup-java that referenced this pull request Jul 17, 2026
actions#1084)
Regenerate the CommonJS bundle so the compiled dist/ reflects the
source changes backported from main, without the ESM migration (actions#1078).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for freeto 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

@priyagupta108@gdams@HarithaVattikuti