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

fix: add back CJS support, with a test #154

Merged
merged 4 commits into from
Nov 20, 2023

Conversation

JoshuaKGoldberg
Copy link
Collaborator

@JoshuaKGoldberg JoshuaKGoldberg commented Nov 20, 2023

PR Checklist

Overview

Downgrades @sindresorhus/is down to v4, its last major version that still supported CommonJS.

Adds a test with a .cjs extension and require that will fail if CommonJS support is broken again.

Also adds explicit exports.types to package.json, as I've had to do that in past packages.

"@sindresorhus/is": "^6.0.0",
"char-regex": "^2.0.0",
"@sindresorhus/is": "^4.6.0",
"char-regex": "^1.0.2",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#149 also broke CJS support with char-regex@2.

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review November 20, 2023 07:45
Copy link

codecov bot commented Nov 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6714e21) 100.00% compared to head (68d554f) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #154   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           14        14           
  Lines          263       263           
  Branches        28        28           
=========================================
  Hits           263       263           

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

@JoshuaKGoldberg
Copy link
Collaborator Author

FYI @omnidan - I can merge this in tomorrow if you don't have a chance to look (to unbreak what I broke over the weekend)

assert.any([is.undefined, is.function], fallbackFunction)
assert.function(format)
is.assert.string(input)
is.assert.any([is.default.undefined, is.default.function_], fallbackFunction)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I played around with these a bit but couldn't find anything cleaner. Ran out of time today. But not super please about using a .default. 🤔

@omnidan
Copy link
Owner

omnidan commented Nov 20, 2023

@JoshuaKGoldberg please do so, I quickly checked and, while it is annoying that we have to downgrade, it is fine for now. We will have to look at dropping CJS support in the future I guess, but for now I believe it's still too frequently used.

@omnidan
Copy link
Owner

omnidan commented Nov 20, 2023

I think we have to stop the renovate bot from upgrading those packages though 😅

@JoshuaKGoldberg
Copy link
Collaborator Author

Yeah a test that fails on CJS breakages should stop it. Renovate can also be told to hush for particular packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants