Migrate to ESM and upgrade dependencies#763
Open
priyagupta108 wants to merge 4 commits into
Open
Conversation
There was a problem hiding this comment.
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__dirnameusage withimport.meta.urlpath resolution. - Update testing and linting for ESM: add
jest.config.ts, add flat-configeslint.config.mjs, and introducetsconfig.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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Convert to ESM, update imports/tests/configs for ESM, and bump dependencies.
Related issue:
Add link to the related issue.
Check list: