Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to esm #107

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Convert to esm #107

wants to merge 18 commits into from

Conversation

mroderick
Copy link
Member

@mroderick mroderick commented Dec 29, 2023

This PR is the first in a series to convert all the Sinon repositories from CommonJS to ESM.

Process:

  1. Configure repository to use .cjs extenssion
  2. Make sure that the build creates both .cjs and .mjs versions
  3. Configure exports in package.json`
  4. Convert the files one by one, going from root to leaves (I tried from leaf to root, and that was nothing but problems)
  5. Replace nyc with c8, as nyc doesn't (yet) support ESM
  6. Publish with a dist-tag of next, so we can show that it works in the Sinon dependents before cutting a new release

Copy link

codecov bot commented Dec 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d23fc83) 100.00% compared to head (b35b006) 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##              main      #107    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           19        13     -6     
  Lines           91       349   +258     
  Branches         0        41    +41     
==========================================
+ Hits            91       349   +258     
Flag Coverage Δ
unit 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@mroderick mroderick marked this pull request as ready for review January 20, 2024 15:06
nyc doesn't support ESM, but c8 does and is a drop in replacement

See https://github.com/bcoe/c8
@mroderick
Copy link
Member Author

mroderick commented Jan 20, 2024

I published an alpha version using npm version premajor --preid=alpha: 4.0.0-alpha.0 ... hopefully no one are using * versions to import this package.

npm info @sinonjs/commons

@sinonjs/[email protected] | BSD-3-Clause | deps: 1 | versions: 25
Simple functions shared among the sinon end user libraries
https://github.com/sinonjs/commons#readme

dist
.tarball: https://registry.npmjs.org/@sinonjs/commons/-/commons-4.0.0-alpha.0.tgz
.shasum: 41fa7570fdc19265981f48ad8520d79703be4ecd
.integrity: sha512-D6UsFb7vj6k/iDBr3TVks/9BHc9vvClRK7JbM3NtxmmV/r2/i/6uh8Z78y4NGMaj2JTRjN2Hy3TTMB5+gPaK5g==
.unpackedSize: 64.0 kB

dependencies:
type-detect: 4.0.8

maintainers:
- mrgnrdrck <[email protected]>
- fatso83 <[email protected]>
- mantoni <[email protected]>
- cjohansen <[email protected]>
- benjamin.gruenbaum <[email protected]>
- simenb <[email protected]>

dist-tags:
latest: 4.0.0-alpha.0

published just now by mrgnrdrck <[email protected]>

Copy link

@fatso83 fatso83 left a comment

Choose a reason for hiding this comment

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

Looks fine!

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.

2 participants