Migrate to ESM and upgrade dependencies#1330
Open
priyagupta108 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the setup-python GitHub Action codebase to ESM (TypeScript NodeNext + package "type": "module") while upgrading core runtime/tooling dependencies, and updating Jest/ESLint/Prettier configuration to align with the new module system.
Changes:
- Switch TypeScript compilation to
module: NodeNextand update internal imports to explicit.jsspecifiers for ESM compatibility. - Upgrade
@actions/*, Jest, ESLint, TypeScript, and related tooling; migrate ESLint to flat config and Jest to an ESM-compatible TS config. - Update tests to ESM patterns (top-level
await,jest.unstable_mockModule) and refresh dependency license metadata.
Reviewed changes
Copilot reviewed 55 out of 66 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Switch TS output module kind to NodeNext and exclude ESM Jest config from build compilation. |
| tsconfig.eslint.json | Add a dedicated TS config for ESLint/IDE usage with broader includes. |
| src/utils.ts | Add explicit string[] typings to avoid implicit any[] under strict mode. |
| src/setup-python.ts | Update relative imports to .js, add ESM-compatible __dirname replacement, and adjust a catch clause. |
| src/install-python.ts | Update utils import to .js and modernize ExecOptions type import. |
| src/install-pypy.ts | Update utils import to .js for ESM. |
| src/install-graalpy.ts | Update utils import to .js for ESM. |
| src/find-python.ts | Update local imports to .js for ESM. |
| src/find-pypy.ts | Update local imports to .js for ESM. |
| src/find-graalpy.ts | Update local imports to .js for ESM. |
| src/cache-save.ts | Update cache-distributor import to .js for ESM. |
| src/cache-distributions/poetry-cache.ts | Update relative imports to .js for ESM. |
| src/cache-distributions/pipenv-cache.ts | Update relative imports to .js for ESM. |
| src/cache-distributions/pip-cache.ts | Update relative imports to .js for ESM. |
| src/cache-distributions/cache-factory.ts | Update relative imports to .js for ESM. |
| src/cache-distributions/cache-distributor.ts | Update relative imports to .js for ESM. |
| package.json | Declare ESM package type, update scripts for flat ESLint/Jest ESM, and upgrade dependencies/devDependencies. |
| jest.config.ts | Add Jest TS config for ESM + ts-jest (useESM) and .js-specifier mapping. |
| jest.config.js | Remove legacy CommonJS Jest config. |
| eslint.config.mjs | Add ESLint flat config (TS + Jest + Node rules + Prettier). |
| dist/setup/package.json | Mark the bundled action entrypoint directory as ESM. |
| dist/cache-save/package.json | Mark the bundled post-action entrypoint directory as ESM. |
| .prettierrc.json | Add JSON-based Prettier config (replacing JS config). |
| .prettierrc.js | Remove legacy JS-based Prettier config. |
| .licensed.yml | Add newly-introduced transitive deps to the reviewed allowlist. |
| .eslintrc.js | Remove legacy ESLint config (replaced by flat config). |
| .eslintignore | Remove legacy ignore file (handled by flat config ignores). |
| tests/utils.test.ts | Convert tests to ESM-style module mocking and dynamic imports. |
| tests/install-python.test.ts | Convert tests to ESM-style module mocking and dynamic imports. |
| tests/install-pypy.test.ts | Convert tests to ESM-style module mocking/dynamic imports and JSON import assertions. |
| tests/install-graalpy.test.ts | Convert tests to ESM-style module mocking/dynamic imports and JSON import assertions. |
| tests/finder.test.ts | Convert tests to ESM-style module mocking/dynamic imports and adjust mocking strategy. |
| tests/find-python.test.ts | Update imports to .js for ESM. |
| tests/find-pypy.test.ts | Convert tests to ESM-style module mocking/dynamic imports and JSON import assertions. |
| tests/find-graalpy.test.ts | Convert tests to ESM-style module mocking/dynamic imports and JSON import assertions. |
| tests/cache-save.test.ts | Convert tests to ESM-style module mocking/dynamic imports. |
| tests/cache-restore.test.ts | Convert tests to ESM-style module mocking/dynamic imports and async restore result handling. |
| .licenses/npm/semver.dep.yml | Update semver license metadata to v7.8.5. |
| .licenses/npm/semver-6.3.1.dep.yml | Remove old semver v6.3.1 license metadata. |
| .licenses/npm/path-expression-matcher.dep.yml | Update path-expression-matcher license metadata version. |
| .licenses/npm/minimatch-3.1.5.dep.yml | Add minimatch v3.1.5 license metadata. |
| .licenses/npm/minimatch-10.2.5.dep.yml | Add minimatch v10.2.5 license metadata. |
| .licenses/npm/fast-xml-parser.dep.yml | Update fast-xml-parser license metadata version/homepage formatting. |
| .licenses/npm/brace-expansion-5.0.6.dep.yml | Update/add brace-expansion v5.0.6 license metadata content. |
| .licenses/npm/brace-expansion-1.1.15.dep.yml | Update brace-expansion v1.1.x license metadata version. |
| .licenses/npm/balanced-match-4.0.4.dep.yml | Add balanced-match v4.0.4 license metadata. |
| .licenses/npm/balanced-match-1.0.2.dep.yml | Add balanced-match v1.0.2 license metadata. |
| .licenses/npm/@typespec/ts-http-runtime.dep.yml | Update @typespec/ts-http-runtime license metadata version/homepage. |
| .licenses/npm/@azure/storage-common.dep.yml | Update @azure/storage-common license metadata version/homepage. |
| .licenses/npm/@azure/storage-blob.dep.yml | Update @azure/storage-blob license metadata version/homepage. |
| .licenses/npm/@azure/core-xml.dep.yml | Update @azure/core-xml license metadata version. |
| .licenses/npm/@azure/core-rest-pipeline.dep.yml | Update @azure/core-rest-pipeline license metadata version/homepage. |
| .licenses/npm/@azure/core-http-compat.dep.yml | Update @azure/core-http-compat license metadata version. |
| .licenses/npm/@azure/core-client.dep.yml | Update @azure/core-client license metadata version. |
| .licenses/npm/@azure/abort-controller.dep.yml | Add @azure/abort-controller v2.x license metadata. |
| .licenses/npm/@actions/tool-cache.dep.yml | Update @actions/tool-cache license metadata version. |
| .licenses/npm/@actions/io.dep.yml | Update @actions/io license metadata version. |
| .licenses/npm/@actions/http-client.dep.yml | Update @actions/http-client license metadata version. |
| .licenses/npm/@actions/glob-0.7.0.dep.yml | Add @actions/glob v0.7.0 license metadata. |
| .licenses/npm/@actions/glob-0.6.1.dep.yml | Update @actions/glob v0.6.x license metadata version reference. |
| .licenses/npm/@actions/exec.dep.yml | Update @actions/exec license metadata version. |
| .licenses/npm/@actions/core.dep.yml | Update @actions/core license metadata version. |
| .licenses/npm/@actions/cache.dep.yml | Update @actions/cache license metadata version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dfabef6 to
d266e93
Compare
d266e93 to
ee43a06
Compare
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:
Describe your changes.
Related issue:
Add link to the related issue.
Check list: