feat: Use generated email templates#305
Open
hhvrc wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces a React-Email + pnpm-based source-of-truth for the API’s transactional SMTP templates and generates the Liquid files during dotnet build/publish, replacing the previously committed .liquid templates.
Changes:
- Add
API/SmtpTemplatesNode workspace (React-Email templates + exporter) and supporting TypeScript config/docs. - Update
API/API.csprojto (1) install template deps, (2) export.liquidfiles, and (3) include generated templates as publish/output content. - Update Docker/CI workflows to ensure Node + pnpm are available during builds that publish the API.
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| docker/API.Dockerfile | Installs Node + pnpm in the API build stage so MSBuild template generation can run during publish. |
| API/API.csproj | Adds MSBuild targets to install deps, export Liquid templates, and include generated .liquid files in output/publish. |
| API/SmtpTemplates/package.json | Defines the React-Email workspace, scripts (dev/export), and pins toolchain/deps. |
| API/SmtpTemplates/pnpm-lock.yaml | Locks Node dependencies for deterministic template builds. |
| API/SmtpTemplates/tsconfig.json | TypeScript configuration for the template workspace. |
| API/SmtpTemplates/scripts/export-templates.ts | Exports .tsx templates into dist/*.liquid with subject on line 1. |
| API/SmtpTemplates/README.md | Documents how templates build via MSBuild and how to develop/export locally. |
| API/SmtpTemplates/.gitignore | Ignores node_modules, build outputs, and React-Email dev artifacts. |
| API/SmtpTemplates/emails/EmailVerification.tsx | React-Email version of the email verification template. |
| API/SmtpTemplates/emails/PasswordReset.tsx | React-Email version of the password reset template. |
| API/SmtpTemplates/emails/EmailChangeNotice.tsx | React-Email version of the email change notice template. |
| API/SmtpTemplates/emails/AccountActivation.tsx | React-Email version of the account activation template. |
| API/SmtpTemplates/emails/_lib/components.tsx | Shared React-Email building blocks (layout, paragraph, CTA button, etc.). |
| API/SmtpTemplates/emails/_lib/styles.ts | Shared inline style definitions for templates. |
| API/SmtpTemplates/emails/_lib/placeholders.ts | Utility to convert sampleProps keys into Liquid placeholders during export. |
| API/SmtpTemplates/EmailVerification.liquid | Removes committed Liquid template (now generated). |
| API/SmtpTemplates/PasswordReset.liquid | Removes committed Liquid template (now generated). |
| API/SmtpTemplates/EmailChangeNotice.liquid | Removes committed Liquid template (now generated). |
| API/SmtpTemplates/AccountActivation.liquid | Removes committed Liquid template (now generated). |
| .github/workflows/ci-build.yml | Installs Node + pnpm in CI because API build/test now generates templates. |
| .github/workflows/codeql.yml | Installs Node + pnpm for CodeQL job because API publish now generates templates. |
Files not reviewed (1)
- API/SmtpTemplates/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| <Target Name="InstallEmailTemplateDeps" | ||
| Inputs="$(SmtpTemplatesDir)\package.json;$(SmtpTemplatesDir)\pnpm-lock.yaml" | ||
| Outputs="$(SmtpTemplatesDir)\node_modules\.package-lock.json"> |
|
|
||
| # Node + pnpm: required by the API.csproj MSBuild target that renders the | ||
| # React-Email templates to SmtpTemplates/dist/*.liquid during publish. | ||
| RUN apk add --no-cache nodejs npm \ |
|
|
||
| export function AccountActivation(props: AccountActivationProps) { | ||
| return ( | ||
| <Layout heading="Active your account!"> |
Comment on lines
+52
to
+58
| # API.csproj builds the React-Email templates during dotnet build/test. | ||
| - uses: pnpm/action-setup@v4 | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'pnpm' | ||
| cache-dependency-path: API/SmtpTemplates/pnpm-lock.yaml |
Comment on lines
+44
to
+50
| # API.csproj builds the React-Email templates during dotnet publish. | ||
| - uses: pnpm/action-setup@v4 | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'pnpm' | ||
| cache-dependency-path: API/SmtpTemplates/pnpm-lock.yaml |
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.
No description provided.