Skip to content

Commit 40667d5

Browse files
marknet15claude
andcommitted
build: convert to ESM and take @actions/core 3 and @actions/github 9
The CJS bundle could not resolve @actions/core 3.x or @actions/github 9.x, both of which are ESM-only. Converting the project to ESM unblocks both majors. - package.json gains "type": "module". Relative imports now carry the explicit .js extensions NodeNext requires; tsc rejects the build without them. - Bundling moves from @vercel/ncc to esbuild. ncc has no ESM output mode, as its --target flag sets the language target rather than the module format. - The bundle banner injects createRequire. Bundled CommonJS dependencies lazily require() Node built-ins, which esbuild rewrites to a shim that throws in ESM scope unless a require binding exists in module scope. - ncc type-checked as a side effect of bundling and esbuild does not, so an explicit typecheck script (tsc --noEmit) replaces it and runs in CI. - dist/licenses.txt and dist/sourcemap-register.js were ncc-specific artifacts and are removed. A process.setSourceMapsEnabled(true) banner replaces the latter. - eslint-plugin-import cannot follow NodeNext's .js to .ts mapping, so import/no-unresolved is disabled in favour of the typecheck script. - commitlint.config.js becomes .cjs, as its module.exports would throw once the nearest package.json declares type: module. The undici override is retained, as no @actions/* release reaches undici 7 alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 476e670 commit 40667d5

21 files changed

Lines changed: 27168 additions & 42825 deletions

.eslintrc.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ ignorePatterns:
1010
- '!.*'
1111
- '**/node_modules/.*'
1212
- '**/dist/.*'
13-
- '.github/commitlint.config.js'
13+
- '.github/commitlint.config.cjs'
14+
- 'esbuild.config.js'
1415

1516
parser: '@typescript-eslint/parser'
1617

@@ -35,6 +36,10 @@ rules:
3536
'eslint-comments/no-use': 'off',
3637
'eslint-comments/no-unused-disable': 'off',
3738
'import/no-namespace': 'off',
39+
# NodeNext requires relative imports to carry a `.js` extension that resolves
40+
# to a `.ts` source. eslint-plugin-import's node resolver cannot follow that
41+
# mapping; `tsc --noEmit` (npm run typecheck) checks resolution accurately.
42+
'import/no-unresolved': 'off',
3843
'no-console': 'off',
3944
'i18n-text/no-en': 'off',
4045
'no-constant-condition': 'off',

.github/workflows/conventional-commits.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
env:
2222
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2323
with:
24-
commitlintRulesPath: ".github/commitlint.config.js"
24+
commitlintRulesPath: ".github/commitlint.config.cjs"

.github/workflows/lint-and-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@ jobs:
2626
- name: Lint
2727
run: npm run lint
2828

29+
- name: Typecheck
30+
run: npm run typecheck
31+
2932
- name: Test
3033
run: npm test

0 commit comments

Comments
 (0)