cucumber / react-components

React components for Cucumber
MIT License
32 stars 10 forks source link

Switch to ESM #338

Closed davidjgoss closed 9 months ago

davidjgoss commented 9 months ago

🤔 What's changed?

This package is now an ES module (ESM), meaning the context you consume it in must support ESM. In practise, that's module bundlers like Webpack and Vite which is all fine, so there is no need to have the transitional step of a "hybrid" package like we have done with cucumber-js and our another Node.js-oriented packages.

The significant changes are to config and setup code, and some dependencies which needed bumping to fix issues with types etc. On the other hand, the majority of the diff is adding .js suffixes to relative imports in TS files, which looks weird but is correct (I switched on a lint rule so we always do that in future).

This is a big change and as such I've dropped this into html-formatter locally, built it and used it with cucumber-js and done some exploratory testing, and everything is working as expected.

Also whilst this will be exactly the same behaviour for end users of formatters, this should be released as a major since anyone directly using the components may have some config/tooling changes to adopt.

⚡️ What's your motivation?

This will enable us to consume ESM-only dependencies where we have recently been blocked on upgrading or adopting them.

Fixes #7

🏷️ What kind of change is this?

📋 Checklist:


This text was originally generated from a template, then edited by hand. You can modify the template here.

netlify[bot] commented 9 months ago

Deploy Preview for cucumber-react-components failed.

Name Link
Latest commit 231054cf1acf79e061a42cd27c388953977c0745
Latest deploy log https://app.netlify.com/sites/cucumber-react-components/deploys/6567cb036572db00085745ad
davidjgoss commented 9 months ago

(Ignore Netlify issues - these were already present and will be fixed by #337.)