Skip to content

Switch to ESM for source and test, use CommonJS for dist#806

Merged
eifinger merged 1 commit intomainfrom
bump-deps-v2
Mar 14, 2026
Merged

Switch to ESM for source and test, use CommonJS for dist#806
eifinger merged 1 commit intomainfrom
bump-deps-v2

Conversation

@eifinger
Copy link
Copy Markdown
Collaborator

No description provided.

@eifinger eifinger added the ci Pull requests that change the CI workflows label Mar 14, 2026
@eifinger eifinger marked this pull request as ready for review March 14, 2026 16:37
@eifinger eifinger requested a review from Copilot March 14, 2026 16:37
Copy link
Copy Markdown

Copilot AI left a comment

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 repository’s source and unit test environment to ESM while keeping the published GitHub Action artifacts in dist/ bundled as CommonJS (.cjs) for runtime compatibility.

Changes:

  • Switch TypeScript/Jest configuration to an ESM-oriented setup (type: module, ESM ts-jest preset, updated TS compiler options).
  • Replace ncc packaging with an esbuild-based bundling script that emits CommonJS .cjs entrypoints.
  • Update action metadata, workflows, and scripts to reference the new dist/**/index.cjs outputs.

Reviewed changes

Copilot reviewed 14 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tsconfig.json Moves TS config to ESM/bundler-oriented compiler settings and narrows compilation to src/**.
src/update-known-checksums.ts Updates CLI usage text to reference .cjs dist entrypoint.
src/setup-uv.ts Adjusts matcher path construction (introduces sourceDir).
scripts/build-dist.mjs New esbuild-based bundler emitting CommonJS .cjs outputs and removing stale .mjs files.
package.json Sets type: module, updates scripts for ESM Jest, swaps packaging to esbuild script, updates deps.
jest.config.mjs Adds ESM Jest configuration via ts-jest ESM preset.
jest.config.js Removes old CommonJS Jest configuration.
action.yml Points main/post to dist/**/index.cjs for the Node 24 action runtime.
tests/version/tool-versions-file.test.ts Converts mocks/imports to ESM-friendly jest.unstable_mockModule + dynamic import.
tests/utils/inputs.test.ts Converts core mocking to ESM-friendly jest.unstable_mockModule + dynamic import helper.
tests/download/versions-client.test.ts Updates mocking/import style for ESM Jest execution.
tests/download/version-manifest.test.ts Updates mocking/import style for ESM Jest execution.
tests/download/download-version.test.ts Updates mocking/import style for ESM Jest execution; adjusts @actions/tool-cache mock surface.
AGENTS.md Documents the intended split: ESM-friendly source/tests vs CommonJS bundled dist artifacts.
.github/workflows/update-known-checksums.yml Uses .nvmrc and updates invocation to .cjs.
.github/workflows/test.yml Adjusts ad-hoc tsc invocation to emit runnable output under type: module.

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

@eifinger eifinger merged commit fd8f376 into main Mar 14, 2026
93 checks passed
@eifinger eifinger deleted the bump-deps-v2 branch March 14, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Pull requests that change the CI workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants