kentcdodds / kcd-scripts

CLI toolbox for common scripts for my projects
http://npm.im/kcd-scripts
MIT License
885 stars 207 forks source link

fix(utils): setup extension by format in getRollupOutput (maybe breaking-change) #244

Closed syi0808 closed 3 months ago

syi0808 commented 3 months ago

What: Set build output file extension by target format.

Why: https://github.com/testing-library/react-testing-library/issues/1338 I looking for a solution to this issue. First of all, the issue was different from testing-library/dom, which is referred to in testing-library/react, and testing-library/dom, which is referred to in testing-library/user-event. So I solved this problem by changing the extension of the esm file to .mjs.

testing-library was using that library as a build tool, and found out that within that library they were building extensions as fixed as .js and are trying to fix it.

Screenshot

Before change extension

Screenshot 2024-07-11 at 11 29 48 PM After configure in testing-library/react, but getConfig().eventWrapper in testing-library/user-event is default function.

After change extension

Screenshot 2024-07-11 at 11 52 11 PM After configure in testing-library/react, so getConfig().eventWrapper in testing-library/user-event is configured function.

How: Set file extension string using format parameter.

Checklist:

syi0808 commented 3 months ago

I think we would make BUILD_WITH_TYPE_EXTENSION as boolean option and applying extension if BUILD_WITH_TYPE_EXTENSION is true, it will be not breaking changes.

github-actions[bot] commented 3 months ago

:tada: This PR is included in version 16.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

syi0808 commented 3 months ago

I think this is fine, but I believe this would be a breaking change, no? I just want to verify that before I trigger a release.

~~I think so. Maybe libraries that use this should be change output file extension, if they want to upgrade version. So maybe we change to optional this. and next major version set it default impl. How about it?~~