Skip to content

Switch all packages to being ESM-only#1482

Merged
Andarist merged 50 commits intonextfrom
type-module
Mar 4, 2025
Merged

Switch all packages to being ESM-only#1482
Andarist merged 50 commits intonextfrom
type-module

Conversation

@Andarist
Copy link
Copy Markdown
Member

@Andarist Andarist commented Oct 5, 2024

No description provided.

@Andarist Andarist requested review from bluwy and emmatown October 5, 2024 07:17
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Oct 5, 2024

🦋 Changeset detected

Latest commit: 60335f0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 21 packages
Name Type
@changesets/get-version-range-type Major
@changesets/assemble-release-plan Major
@changesets/get-dependents-graph Major
@changesets/should-skip-package Major
@changesets/apply-release-plan Major
@changesets/changelog-github Major
@changesets/get-release-plan Major
@changesets/get-github-info Major
@changesets/changelog-git Major
@changesets/release-utils Major
@changesets/config Major
@changesets/errors Major
@changesets/logger Major
@changesets/parse Major
@changesets/types Major
@changesets/write Major
@changesets/read Major
@changesets/cli Major
@changesets/git Major
@changesets/pre Major
@changesets/test-utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@bluwy
Copy link
Copy Markdown
Member

bluwy commented Oct 5, 2024

Looks like we also need to be a good citizen now and not use plain require, but createRequire or import instead 😄 Which is probably a good thing anyways. Interestingly this seems to imply that the pure ESM output we had in v2 never quite worked in node, only in bundlers that could handle bundling require().

@Andarist
Copy link
Copy Markdown
Member Author

Andarist commented Oct 5, 2024

Interestingly this seems to imply that the pure ESM output we had in v2 never quite worked in node

That's fine - node wasn't receiving any ESM files from us in v2 beyond short reexporting .mjs wrappers. They were just proxying to CJS files.

@benmccann benmccann mentioned this pull request Oct 5, 2024
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 22, 2025

Codecov Report

Attention: Patch coverage is 89.83051% with 24 lines in your changes missing coverage. Please review.

Project coverage is 71.65%. Comparing base (e4da05f) to head (60335f0).
Report is 1 commits behind head on next.

Files with missing lines Patch % Lines
packages/release-utils/src/utils.ts 75.00% 11 Missing ⚠️
packages/cli/src/index.ts 0.00% 3 Missing ⚠️
packages/release-utils/src/index.ts 0.00% 2 Missing and 1 partial ⚠️
packages/release-utils/src/run.ts 90.32% 3 Missing ⚠️
...rc/test-utils/get-changelog-entry-with-git-hash.ts 0.00% 2 Missing ⚠️
packages/cli/bin.js 0.00% 1 Missing ⚠️
packages/cli/src/commands/add/index.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #1482      +/-   ##
==========================================
- Coverage   80.75%   71.65%   -9.10%     
==========================================
  Files          52       65      +13     
  Lines        2234     5007    +2773     
  Branches      665      871     +206     
==========================================
+ Hits         1804     3588    +1784     
- Misses        425     1414     +989     
  Partials        5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Andarist Andarist marked this pull request as ready for review February 22, 2025 18:02
@Andarist
Copy link
Copy Markdown
Member Author

@emmatown @bluwy this is ready for a proper review :)

@Andarist
Copy link
Copy Markdown
Member Author

@remorses is there any specific reason why you have downvoted this?

Copy link
Copy Markdown
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Looks great to me! I didn't expect Jest to be swapped out with Vitest here, but I welcome it 😄

I tested this locally a bit and all seems to be working well. Should we add the major changesets too?

Comment thread scripts/test-utils/package.json
Comment thread packages/release-utils/package.json Outdated
@Andarist
Copy link
Copy Markdown
Member Author

Looks great to me! I didn't expect Jest to be swapped out with Vitest here, but I welcome it 😄

I almost had it working with Jest but it tried to execute ESM node_modules through script.runInContext (or similar) and that just didn't work. I probably could make it transform node_modules but I gave up and just switched to Vitest

Should we add the major changesets too?

Yeah. Thanks for the reminder

Comment thread packages/release-utils/src/utils.ts Outdated
Copy link
Copy Markdown
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Changes look good to me 👍

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
@Andarist Andarist merged commit df424a4 into next Mar 4, 2025
@Andarist Andarist deleted the type-module branch March 4, 2025 09:56
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.

3 participants