feat: Upgrade to MJML5 and prepare for V4 release#147
Conversation
|
@AshCorr @emmclaughlin , any ways we can help on this? Keen to see this out. |
Ah sorry, I got a bit stuck. For some reason the dist tests ( However the same tests work fine in dev mode ( Attaching a debugger I noticed that when running |
moduleNameMapper: {
"^src(.*)$": "<rootDir>/dist$1",
},mjml-react/jest-dist.config.js Line 8 in 44a28ea Don't know if it is the right fix, but this points that the problem lies in jest config. edit: actually it just makes the tests not to run against dist. so ignore this |
|
The cssnano has its main defined as `src/index.js: The That is why cssnano import gets @faire/mjml-react as its module. Setting the moduleNameMapper to include moduleNameMapper: {
"\\.\\./src(.*)$": "<rootDir>/dist$1",
},It ain't pretty fix though. |
|
|
|
Since this is going to be v4 release, I'd bump the tsconfig target to es2020 too. Easier to use debugger when async..await is not transformed. |
Aha! Thanks, I'll give that a shot and update this PR today! |
BREAKING CHANGE: The `render` function is now asynchronous and returns a promise. This is because MJML v5 introduces asynchronous rendering which is non optional.
…in dist tests Co-authored-by: anajavi <anajavi@users.noreply.github.com>
|
This PR is still draft. Should it be set to ready for review? |
Just testing everything! Also wondering if we should do some dependency upgrades, but maybe that should be a follow up PR. Would be nice to release V4 with the latest versions of everything rather than just MJML. |
|
Alrighty, I published a test version to Obviously we're not going to be using all of the functionality of mjml-react, so this test wouldn't have covered everything, but hopefully the unit tests that mjml-react has will be enough to catch any other regressions. |
| "format": "prettier --write .", | ||
| "test": "jest", | ||
| "test-dist-skip-build": "jest --config=jest-dist.config.js", | ||
| "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js", |
There was a problem hiding this comment.
Without --experimental-vm-modules Jest seemingly explodes due to a dependency on prettier@3.0.0 by mjml-core
prettier/prettier#15769 (I tried upgrading to Jest v30 and it didnt fix the issue)
I created a PR for typescript upgrade #149. |
|
@emmclaughlin FYI! |
emmclaughlin
left a comment
There was a problem hiding this comment.
Thanks for taking this on! Left a few comments
Upgrades
@faire/mjml-reactto MJML v5 which was released a few weeks ago. This is a breaking change as:mjmlToHtmlfunction, meaning@faire/mjml-reactwill also have to use async functions.html-minifierdependency in exchange forhtmlnano+cssnanoandThis PR also prepares the documentations for a V4 release. Previously the documentation hinted at a V4 release that would include more type safety, however its been 3 years since work on that V4 release began and it seems like it might be dead now, so I've removed that documentation for the time being in order to use the v4 tag for this breaking change.
Fixes #145