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(jsx-email): change how package.json is read so it doesn't break with recent node versions #215

Merged
merged 1 commit into from
Oct 13, 2024

Conversation

isaacdonaldson
Copy link
Contributor

Component / Package Name: jsx-email

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, please include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

Description

Node v22 deprecated the use of the assert { type: 'json' } syntax when importing modules in favour of the with { type: 'json' } syntax (they are used when reading JSON). The assert syntax was used up until v22, and the with syntax started being supported in node v18.20. jsx-email supports version 18.19+ meaning using the with syntax would be a breaking change.

The reading of JSON was happening when the cli tool was reading from the package.json. This PR introduces the change that instead of reading the package.json as a module, we read it inside a .cts file which does not use the same assert/with syntax.

This PR is a little tricky to test (and why there are no test cases added), but it looks to work on node versions: 18.19.0, 18.20.0, and 22.6.0. I don't believe any issues should occur because the "esModuleInterop" option in the tsconfig.json is set to true, but some extra care wouldn't hurt.

@shellscape shellscape changed the title Change how package.json is read so it doesn't break with recent node versions fix(jsx-email): change how package.json is read so it doesn't break with recent node versions Oct 11, 2024
@shellscape
Copy link
Owner

Thanks for making this happen. Sorry that I wasn't able to get to merging it until now - we just got power back on today. Hurricanes are bananas.

@shellscape shellscape merged commit 5fa2b17 into shellscape:main Oct 13, 2024
5 of 6 checks passed
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