Skip to content

Migrate to ESM and upgrade dependencies#763

Open
priyagupta108 wants to merge 4 commits into
actions:mainfrom
priyagupta108:esm-and-dependency-upgrades
Open

Migrate to ESM and upgrade dependencies#763
priyagupta108 wants to merge 4 commits into
actions:mainfrom
priyagupta108:esm-and-dependency-upgrades

Conversation

@priyagupta108

@priyagupta108 priyagupta108 commented Jun 26, 2026

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:

  • 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 June 26, 2026 05:46
@priyagupta108 priyagupta108 requested a review from a team as a code owner June 26, 2026 05:46
@priyagupta108 priyagupta108 self-assigned this Jun 26, 2026

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 action’s TypeScript/Node codebase to ESM (NodeNext), updates runtime path handling and intra-repo imports for ESM compatibility, modernizes Jest/ESLint/Prettier configuration for ESM, and upgrades runtime/dev dependencies (notably the @actions/* toolkits).

Changes:

  • Switch TypeScript compilation to ESM via NodeNext, update relative imports to include .js, and replace __dirname usage with import.meta.url path resolution.
  • Update testing and linting for ESM: add jest.config.ts, add flat-config eslint.config.mjs, and introduce tsconfig.eslint.json.
  • Bump dependencies and refresh licensed dependency metadata.

Reviewed changes

Copilot reviewed 48 out of 59 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tsconfig.json Switch TS output/module resolution to NodeNext/ES2022 and adjust excludes for ESM-era config layout.
tsconfig.eslint.json Add dedicated TS config to support ESLint/type-aware linting across src/tests (and root TS).
src/system.ts Update local type import to .js extension for ESM compatibility.
src/setup-go.ts Update entrypoint import to .js extension for ESM compatibility.
src/main.ts Update local imports to .js and replace __dirname matcher path logic with import.meta.url-based resolution.
src/installer.ts Update local imports to .js, refactor Go version fetching to use new helper module, and add Error.cause for download errors.
src/go-version-fetch.ts New helper module extracting Go “versions dist” fetch logic for cleaner ESM/module boundaries.
src/cache-utils.ts Update local import to .js and reformat multi-import for ESM.
src/cache-save.ts Update local imports to .js for ESM.
src/cache-restore.ts Update local imports to .js for ESM.
package.json Mark package as ESM (type: module), modernize tool scripts, and bump dependencies/devDependencies.
jest.config.ts Add ESM-aware Jest config using ts-jest with ESM settings and moduleNameMapper for .js specifiers.
jest.config.js Remove legacy CJS Jest config.
eslint.config.mjs Add ESLint flat config (ESM) aligned with new toolchain.
dist/setup/package.json Mark the bundled setup distribution folder as ESM (type: module).
dist/cache-save/package.json Mark the bundled cache-save distribution folder as ESM (type: module).
.prettierrc.json Add JSON-based Prettier config suitable for ESM repos.
.prettierrc.js Remove legacy CJS Prettier config.
.licensed.yml Allow additional licenses introduced by dependency upgrades and update reviewed list.
.eslintrc.js Remove legacy ESLint RC config (superseded by flat config).
.eslintignore Remove legacy ESLint ignore file (superseded by flat config ignores).
tests/windows-toolcache.test.ts Convert Jest tests to ESM-friendly mocking (unstable_mockModule) and explicit jest globals import.
tests/utils.test.ts Update src import to .js and adopt explicit jest globals import.
tests/setup-go.test.ts Convert mocks/imports to ESM approach, update JSON imports to import attributes, and adjust spies to mock-based types.
tests/cache-utils.test.ts Convert to ESM-friendly mocking and adjust spies to mock-based types.
tests/cache-save.test.ts Convert to ESM-friendly mocking (including fs), and update imports to .js.
tests/cache-restore.test.ts Convert to ESM-friendly mocking and update imports to .js.
.licenses/npm/strnum.dep.yml Update licensed metadata version for dependency changes.
.licenses/npm/semver.dep.yml Add new licensed metadata for upgraded semver.
.licenses/npm/semver-6.3.1.dep.yml Remove old semver licensed metadata entry.
.licenses/npm/path-expression-matcher.dep.yml Update licensed metadata version for dependency changes.
.licenses/npm/minimatch-3.1.5.dep.yml Add licensed metadata for minimatch v3 line (transitive).
.licenses/npm/minimatch-10.2.5.dep.yml Add licensed metadata for minimatch v10 line (transitive).
.licenses/npm/is-unsafe.dep.yml Update licensed metadata content to match the correct package/version.
.licenses/npm/fast-xml-parser.dep.yml Update licensed metadata version for dependency changes.
.licenses/npm/brace-expansion-5.0.6.dep.yml Add licensed metadata for newer brace-expansion (transitive).
.licenses/npm/brace-expansion-1.1.15.dep.yml Update licensed metadata version for dependency changes.
.licenses/npm/balanced-match-4.0.4.dep.yml Add licensed metadata for newer balanced-match (transitive).
.licenses/npm/balanced-match-1.0.2.dep.yml Add licensed metadata for balanced-match (transitive).
.licenses/npm/anynum.dep.yml Update licensed metadata version for dependency changes.
.licenses/npm/@typespec/ts-http-runtime.dep.yml Update licensed metadata version/homepage for dependency changes.
.licenses/npm/@azure/storage-common.dep.yml Update licensed metadata version/homepage for dependency changes.
.licenses/npm/@azure/storage-blob.dep.yml Update licensed metadata version/homepage for dependency changes.
.licenses/npm/@azure/core-xml.dep.yml Update licensed metadata version for dependency changes.
.licenses/npm/@azure/core-rest-pipeline.dep.yml Update licensed metadata version/homepage for dependency changes.
.licenses/npm/@azure/core-http-compat.dep.yml Update licensed metadata version for dependency changes.
.licenses/npm/@azure/core-client.dep.yml Update licensed metadata version for dependency changes.
.licenses/npm/@azure/abort-controller.dep.yml Add licensed metadata for abort-controller (transitive).
.licenses/npm/@actions/tool-cache.dep.yml Update licensed metadata version for toolkit upgrade.
.licenses/npm/@actions/io.dep.yml Update licensed metadata version for toolkit upgrade.
.licenses/npm/@actions/http-client.dep.yml Update licensed metadata version for toolkit upgrade.
.licenses/npm/@actions/glob-0.7.0.dep.yml Add licensed metadata for newer @actions/glob (toolkit upgrade).
.licenses/npm/@actions/glob-0.6.1.dep.yml Update licensed metadata version for toolkit upgrade path.
.licenses/npm/@actions/exec.dep.yml Update licensed metadata version for toolkit upgrade.
.licenses/npm/@actions/core.dep.yml Update licensed metadata version for toolkit upgrade.
.licenses/npm/@actions/cache.dep.yml Update licensed metadata version for toolkit upgrade.

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

Comment thread package.json
Comment thread jest.config.ts
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.

2 participants