Skip to content
New issue

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

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

Already on GitHub? # to your account

Migrate to ESM format #117

Merged
merged 17 commits into from
Nov 5, 2023
Merged

Migrate to ESM format #117

merged 17 commits into from
Nov 5, 2023

Conversation

rkotze
Copy link
Owner

@rkotze rkotze commented Oct 29, 2023

Modernising Git Mob by moving over to the natively supported ESM modules in NodeJS.

Support newer versions of Git Mob dependencies as they move over to ESM modules.

This does mean you need to run on Node 16+

Helpful information

Mocking modules require to use of an unstable API and need to enable an experimental flag on the node for jest to use esm.

https://jestjs.io/docs/ecmascript-modules

Also need to run node argument NODE_OPTIONS=--experimental-vm-modules

All imports need to have their file extension .js else it won't find the module and you will get an import errror.

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • All tests and linting (npm run checks) has passed locally and any fixes were made for failures
  • I kept my pull requests small so it can be reviewed easier

Please check the type of change your PR introduces:

  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes

Does this introduce a breaking change?

  • Yes
  • No

Other information

Mocking modules requires to use an unstable api and need to enable experimental flag on node for jest to use esm.

https://jestjs.io/docs/ecmascript-modules
tempy uses ESM

Node options --experimental-vm-modules
Needed to run tests with ESM
@rkotze rkotze self-assigned this Nov 2, 2023
@rkotze rkotze merged commit 6cbda55 into master Nov 5, 2023
@rkotze rkotze deleted the support-esm branch November 5, 2023 13:16
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant