feat: add --react-email flag to send emails from .tsx templates#150
Open
felipefreitag wants to merge 7 commits intomainfrom
Open
feat: add --react-email flag to send emails from .tsx templates#150felipefreitag wants to merge 7 commits intomainfrom
felipefreitag wants to merge 7 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
4 issues found across 15 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/commands/broadcasts/create.ts">
<violation number="1" location="src/commands/broadcasts/create.ts:105">
P2: `--react-email` is incorrectly made mutually exclusive with `--text`/`--text-file`, which blocks valid HTML+text broadcast creation.</violation>
</file>
<file name="src/lib/react-email-bundler.ts">
<violation number="1" location="src/lib/react-email-bundler.ts:18">
P2: Clean up the temp directory when esbuild fails; current error path leaks temporary folders.</violation>
</file>
<file name="src/commands/templates/create.ts">
<violation number="1" location="src/commands/templates/create.ts:108">
P2: `--react-email` incorrectly forbids `--text`/`--text-file`, which breaks the documented plain-text fallback flow.</violation>
</file>
<file name="src/lib/react-email.ts">
<violation number="1" location="src/lib/react-email.ts:19">
P2: Calling `outputError` inside the `try`/`catch` exits the process before the `finally` cleanup runs, so temporary build directories can be leaked on failure paths.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Bundles a React Email .tsx template with esbuild, renders it to HTML, and sends it in one command — matching the react-email export pipeline.
…ands Extracts bundle+render pipeline into shared buildReactEmailHtml() helper and adds --react-email support to emails batch, broadcasts create, broadcasts update, and templates create.
- Clean up temp dir on build failure (wrap both phases in single finally) - Add file-existence check before bundling for clearer error - Move createRequire inside function to avoid module-scope side effect - Update all help text and error messages to mention --react-email
…r on build failure - Narrow conflict check to only --html/--html-file (and --template for send), allowing --text/--text-file as a plain-text fallback alongside --react-email - Clean up temp directory in bundleReactEmail when esbuild throws
process.exit() does not run finally blocks, so temp directories were leaked on render failure. Now cleanup runs explicitly before outputError.
69fe0cf to
ca2d3d8
Compare
- Add React Email to skill description for better triggering - Document --react-email in emails, broadcasts, templates references - Add react_email_build_error and react_email_render_error to error codes - Add React Email examples to workflow recipes (send, broadcast, template)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a --react-email flag that bundles a React Email .tsx template with esbuild, renders it to HTML, and uses it as the email body.
Supported on
emails send,emails batch,broadcasts create,broadcasts update,templates createandtemplates update.Follows the same pipeline as react-email's email export command: esbuild bundle → require → render(createElement(component, {})) → HTML string
Closes #73