feat: convert project to ESM and bump @actions/core from 1.11.1 to 3.0.1#766
Conversation
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.11.1 to 3.0.1. - [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core) --- updated-dependencies: - dependency-name: "@actions/core" dependency-version: 3.0.1 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
54f2ea5 to
f91b1a6
Compare
|
@copilot can you look into this one? |
- Change package.json type from commonjs to module - Convert all source files (src/*.js) to ESM syntax - Rename eslint.config.js to eslint.config.cjs (must stay CJS) - Update action.yml to use await import() instead of require() - Replace proxyquire with esmock in all test files - Upgrade @vercel/ncc to 0.44.0 (supports ESM bundles) - Add esmock dev dependency, remove proxyquire - Rebuild dist/ with ncc 0.44.0 ESM output All 68 tests pass with 100% coverage.
The root cause is that The fix is a full ESM conversion of the project:
All 68 tests pass with 100% code coverage and the build succeeds. |
|
lots of conflicts! |
|
@copilot lots of conflicts! |
…rn/actions/core-3.0.1 # Conflicts: # dist/index.js # package-lock.json # package.json # src/action.js # test/action.test.js
Resolved in b9d8284. Merged
All 98 tests pass with 100% coverage. |
|
@copilot CI is failing. please run tests and linting as part of your work |
Fixed in the latest commit — |
Bumps @actions/core from 1.11.1 to 3.0.1.
@actions/corev3 is ESM-only — itsexportsfield has no"require"condition, making it incompatible with the project's previous CommonJS setup. This PR converts the entire project to ESM in order to support the upgrade.Changes Made
package.json: Changed"type"from"commonjs"to"module", upgraded@vercel/nccto0.44.0(required for ESM bundle output), addedesmock, removedproxyquire, upgradedsinonto^22.0.0src/*.js: All source files converted fromrequire/module.exportsCJS syntax toimport/exportESM syntax, including the newsrc/mergeWindow.jsmodule (business window constraint feature)eslint.config.js→eslint.config.cjs: Renamed so ESLint can load it as CJS when"type": "module"is set inpackage.jsonaction.yml: Changedrequire(ACTION_PATH + '/dist/index.js')toawait import('file://' + ACTION_PATH + '/dist/index.js')to load the ESM bundle; addedmerge-windowandmerge-window-timezoneinputstest/*.test.js: All test files converted from CJS/proxyquireto ESM/esmock, including the newtest/mergeWindow.test.jsdist/: Rebuilt withncc 0.44.0which outputs an ESM bundle when the entry point is ESMTesting
ncc 0.44.0compiles to ESMdist/index.js)