Skip to content

feat: migrate to ESM and upgrade all dependencies#514

Open
mgerlach wants to merge 1 commit into
endorama:mainfrom
mgerlach:upgrade-deps-esm
Open

feat: migrate to ESM and upgrade all dependencies#514
mgerlach wants to merge 1 commit into
endorama:mainfrom
mgerlach:upgrade-deps-esm

Conversation

@mgerlach

Copy link
Copy Markdown
Contributor

Summary

  • Migrates the project from CommonJS to ESM to support @actions/core v3, which is ESM-only
  • Upgrades all pending dependabot dependency bumps in a single PR
  • All 4 tests pass locally on Node 24

Breaking change: @actions/core v3 is ESM-only

To support it, the following migration was required:

  • package.json: added "type": "module", updated test script to use node --experimental-vm-modules for Jest ESM support
  • tsconfig.json: switched to module/moduleResolution: NodeNext, added isolatedModules: true (required by ts-jest with NodeNext)
  • jest.config.js: enabled useESM in ts-jest transform, added extensionsToTreatAsEsm: ['.ts'] and moduleNameMapper to resolve .js imports to .ts source files
  • src/main.ts: updated relative import to ./asdf.js (required by ESM)
  • __tests__/asdf.test.ts: replaced __dirname with import.meta.url-based equivalent, updated import to .js extension
  • __tests__/main.test.ts: updated import to .js extension
  • .eslintrc.json: disabled import/no-unresolved (produces false positives for the .js.ts ESM convention)

Dependency upgrades

Resolves all pending dependabot PRs:

Package From To PR
@actions/core 2.0.2 3.0.1 #507
eslint-plugin-jest 29.12.1 29.15.2 #508
@types/node 25.0.10 25.9.1 #509
@typescript-eslint/eslint-plugin 8.53.1 8.59.4 #510
actions/upload-artifact v6 v7 #511
@typescript-eslint/parser 8.53.1 8.59.4 #505

Test plan

  • npm run build — TypeScript compiles without errors
  • npm run format — no formatting changes needed
  • npm run lint — no lint errors
  • npm run package — ncc bundles successfully (auto-detected ESM output)
  • npm test — all 4 tests pass (2 suites)

Closes #507, #508, #509, #510, #511, #505

🤖 Generated with Claude Code

@mgerlach

mgerlach commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

I am not a total NodeJs/JavaScript/TypeScript expert, so I hope Claude hasn't produced too much slop. I challenged some of the suspicious looking configs, so Claude attempted a few things to reduce the size of the change, but did not succeed. So I did a bit of research regarding some of the changes myself, it looks like Claude is right as is.

This PR should be independent from #513.

Migrate the project from CommonJS to ESM to support @actions/core v3,
which is ESM-only. Also upgrades all other pending dependabot bumps.

Changes:
- package.json: add "type": "module", update test script to use
  --experimental-vm-modules for Jest ESM support
- tsconfig.json: switch to module/moduleResolution NodeNext, add
  isolatedModules: true (required by ts-jest with NodeNext)
- jest.config.js: enable useESM in ts-jest, add extensionsToTreatAsEsm
  and moduleNameMapper to resolve .js imports to .ts source files
- src/main.ts: use ./asdf.js extension (required by ESM)
- __tests__/asdf.test.ts: replace __dirname with import.meta.url,
  update import to use .js extension
- __tests__/main.test.ts: update import to use .js extension
- .eslintrc.json: disable import/no-unresolved (false positives from
  .js→.ts ESM convention)
- .github/workflows/check-dist.yml: bump actions/upload-artifact v6→v7

Dependency upgrades:
- @actions/core 2.0.2 → 3.0.1
- @typescript-eslint/eslint-plugin 8.53.1 → 8.59.4
- @typescript-eslint/parser 8.53.1 → 8.59.4
- @types/node 25.0.10 → 25.9.1
- eslint-plugin-jest 29.12.1 → 29.15.2

Closes endorama#507, endorama#508, endorama#509, endorama#510, endorama#511, endorama#505

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@mgerlach
mgerlach force-pushed the upgrade-deps-esm branch from a92bb8b to 89b6bf7 Compare May 22, 2026 22:17
@endorama

Copy link
Copy Markdown
Owner

Thanks! I'll break this down into smaller and more focused PRs. The changelog is easier to follow that way, considering this is something people install in their CI.

I should be able to push on this branch, no action should be needed from your side.

@mgerlach

mgerlach commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! I'll break this down into smaller and more focused PRs. The changelog is easier to follow that way, considering this is something people install in their CI.

I should be able to push on this branch, no action should be needed from your side.

Hi @endorama, do you need help with splitting up the PR?

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