fix(jsx-email): change how package.json is read so it doesn't break with recent node versions #215
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Component / Package Name:
jsx-email
This PR contains:
Are tests included?
Breaking Changes?
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 thewith { type: 'json' }
syntax (they are used when reading JSON). Theassert
syntax was used up until v22, and thewith
syntax started being supported in node v18.20.jsx-email
supports version 18.19+ meaning using thewith
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 thepackage.json
as a module, we read it inside a.cts
file which does not use the sameassert
/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
, and22.6.0
. I don't believe any issues should occur because the"esModuleInterop"
option in thetsconfig.json
is set totrue
, but some extra care wouldn't hurt.