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

feat!: transitioning to ESM #476

Merged
merged 9 commits into from
Mar 14, 2024
Merged

feat!: transitioning to ESM #476

merged 9 commits into from
Mar 14, 2024

Conversation

nicholasgriffintn
Copy link
Member

@nicholasgriffintn nicholasgriffintn commented Mar 12, 2024

Resolves #467, #466

Description:

To support modern development, this package needs to transition from commonjs, this PR upgrades the codebase across the board to transition (builds will still output to esm and cjs).

It also upgrades a couple of dependencies that were blocked by still not being ESM, chai and p-event.

A discussion for this has been opened up here: #477

Type of change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Why is this change required?:

In order to still be able to update dependencies while supporting and using modern development practices.

Code changes:

  • Adds type module to the package.json
  • Added a script to deploy package.json files for type to the two dist folders
  • Removes main from package.json in favour of exports
  • Sets the TypeScript lib and target config to ES2021, Microsoft says this config should be good to support Node 16: https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping#node-16
  • Transitions all requires to imports
  • Updates the import syntax to use node: and .js
  • Updates cucumber and mocha configuration
  • Adds two builds for ESM and CJS
  • Built files are outputted into ./dist/esm, ./dist/cjs and ./dist/types

For ESM and base:

  • Sets the module and module resolution to Node16

For CJS:

Retains the current config

@nicholasgriffintn nicholasgriffintn added this to the 10.0.0-canary milestone Mar 12, 2024
@nicholasgriffintn nicholasgriffintn linked an issue Mar 12, 2024 that may be closed by this pull request
Copy link

codeclimate bot commented Mar 12, 2024

Code Climate has analyzed commit a411c00 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Style 1

The test coverage on the diff in this pull request is 98.2% (80% is the threshold).

This pull request will bring the total coverage in the repository to 98.3% (0.0% change).

View more on Code Climate.

@nicholasgriffintn nicholasgriffintn marked this pull request as ready for review March 14, 2024 17:30
@nicholasgriffintn nicholasgriffintn requested review from a team as code owners March 14, 2024 17:30
@nicholasgriffintn nicholasgriffintn merged commit a1db8c3 into main Mar 14, 2024
7 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2024
@nicholasgriffintn nicholasgriffintn modified the milestones: 10.0.0-canary, 10.0.0 Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade chai to v5 Upgrade p-event to v6
1 participant