Skip to content

fix(plugin-manifest-validator): migrate dev environment to ESM#3837

Open
nameless-mc wants to merge 2 commits into
mainfrom
fix/esm-plugin-manifest-validator
Open

fix(plugin-manifest-validator): migrate dev environment to ESM#3837
nameless-mc wants to merge 2 commits into
mainfrom
fix/esm-plugin-manifest-validator

Conversation

@nameless-mc

Copy link
Copy Markdown
Contributor

Why

Align @kintone/plugin-manifest-validator with the kintone frontend tech standard by making its development environment ESM, while keeping the published output as CommonJS so existing consumers are unaffected.

What

  • Add "type": "module" so the package is authored and tooled as ESM.
  • Keep the build output in dist/ as CommonJS (tsconfig stays module: commonjs). A generated dist/package.json marker ({"type":"commonjs"}, written by script/write-cjs-pkg.ts) lets Node treat the emitted output as CJS even under the ESM root, so CJS consumers such as @kintone/plugin-packer keep working with require() on Node < 22.
  • Remove dead babel.config.js (CJS, leftover from the jest era; unused since the vitest migration and would break under "type": "module").

How to test

  • pnpm build / pnpm test / pnpm lint
  • Verified the consumer @kintone/plugin-packer still builds and its tests pass against this change.

@nameless-mc nameless-mc requested a review from a team as a code owner June 12, 2026 07:23
@nameless-mc nameless-mc requested review from chihiro-adachi, Copilot and shabaraba and removed request for a team June 12, 2026 07:23
@github-actions github-actions Bot added the pkg: plugin-manifest-validator @kintone/plugin-manifest-validator label Jun 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates @kintone/plugin-manifest-validator’s development/tooling environment to ESM while preserving the published dist/ output as CommonJS to avoid breaking existing CJS consumers.

Changes:

  • Set "type": "module" for the package to author/tool as ESM.
  • Add a post-build step to generate dist/package.json with { "type": "commonjs" } so Node treats emitted dist/ as CJS under an ESM package root.
  • Remove the unused legacy babel.config.js that would be incompatible under ESM.

Reviewed changes

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

File Description
packages/plugin-manifest-validator/script/write-cjs-pkg.ts New build helper to write a dist/package.json CJS marker.
packages/plugin-manifest-validator/package.json Mark package as ESM and run the new CJS marker generation after build.
packages/plugin-manifest-validator/babel.config.js Remove unused Babel config incompatible with ESM package root.

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

Comment thread packages/plugin-manifest-validator/script/write-cjs-pkg.ts Outdated
Set "type": "module" so the package is authored and tooled as ESM, while
keeping the build output in dist/ as CommonJS. A generated dist/package.json
marker ({"type":"commonjs"}) lets Node treat the emitted output as CJS even
under the ESM root, so existing CJS consumers (e.g. @kintone/plugin-packer)
keep working with require() on Node < 22.

- Add "type": "module" to package.json
- Add gen-cjs-pkg build step (script/write-cjs-pkg.ts) writing the dist marker
- Exclude **/dist/** from the pnpm workspace so the generated dist/package.json
  marker is not picked up as a phantom workspace package (mirrors the existing
  lib/esm exclusions)
- Remove dead babel.config.js (CJS, leftover from the jest era; unused since
  the vitest migration and would break under "type": "module")
@nameless-mc nameless-mc force-pushed the fix/esm-plugin-manifest-validator branch from c1f7615 to aff492d Compare June 12, 2026 08:12
write-cjs-pkg: mkdir dist (recursive) before writing the marker so the script
also works when run on its own, not only as the postbuild step after tsc has
already created dist/.
@nameless-mc nameless-mc self-assigned this Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: plugin-manifest-validator @kintone/plugin-manifest-validator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants