From 548c2e44d485ae69337b4f9223386f87cf2bc7eb Mon Sep 17 00:00:00 2001 From: esdrasrenan Date: Sat, 13 Dec 2025 21:06:06 -0300 Subject: [PATCH] fix: estabiliza templates de e-mail no CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Usa @react-email/components nos templates para evitar módulos ausentes no Bun 1.3.1\n- Ajusta preload do bun test para expor global Element (evita crash do PrismJS) --- emails/_components/layout.tsx | 9 +-------- emails/_components/ticket-card.tsx | 3 +-- emails/automation-email.tsx | 6 +----- emails/simple-notification-email.tsx | 6 +----- tests/setup/bun-test-env.ts | 8 ++++++++ 5 files changed, 12 insertions(+), 20 deletions(-) diff --git a/emails/_components/layout.tsx b/emails/_components/layout.tsx index fcfaebc..8c293b5 100644 --- a/emails/_components/layout.tsx +++ b/emails/_components/layout.tsx @@ -1,12 +1,5 @@ import * as React from "react" -import { Body } from "@react-email/body" -import { Container } from "@react-email/container" -import { Head } from "@react-email/head" -import { Html } from "@react-email/html" -import { Img } from "@react-email/img" -import { Preview } from "@react-email/preview" -import { Section } from "@react-email/section" -import { Text } from "@react-email/text" +import { Body, Container, Head, Html, Img, Preview, Section, Text } from "@react-email/components" import { EMAIL_COLORS } from "./tokens" import { getEmailAssetUrl } from "./utils" diff --git a/emails/_components/ticket-card.tsx b/emails/_components/ticket-card.tsx index d2be4cf..31ac291 100644 --- a/emails/_components/ticket-card.tsx +++ b/emails/_components/ticket-card.tsx @@ -1,6 +1,5 @@ import * as React from "react" -import { Section } from "@react-email/section" -import { Text } from "@react-email/text" +import { Section, Text } from "@react-email/components" import { EMAIL_COLORS } from "./tokens" import { formatPriority, formatStatus } from "./utils" diff --git a/emails/automation-email.tsx b/emails/automation-email.tsx index fbffc9f..ebc900c 100644 --- a/emails/automation-email.tsx +++ b/emails/automation-email.tsx @@ -1,9 +1,5 @@ import * as React from "react" -import { Button } from "@react-email/button" -import { Heading } from "@react-email/heading" -import { Hr } from "@react-email/hr" -import { Section } from "@react-email/section" -import { Text } from "@react-email/text" +import { Button, Heading, Hr, Section, Text } from "@react-email/components" import { RavenEmailLayout } from "./_components/layout" import { EMAIL_COLORS } from "./_components/tokens" diff --git a/emails/simple-notification-email.tsx b/emails/simple-notification-email.tsx index fc3124d..8c64543 100644 --- a/emails/simple-notification-email.tsx +++ b/emails/simple-notification-email.tsx @@ -1,9 +1,5 @@ import * as React from "react" -import { Button } from "@react-email/button" -import { Heading } from "@react-email/heading" -import { Hr } from "@react-email/hr" -import { Section } from "@react-email/section" -import { Text } from "@react-email/text" +import { Button, Heading, Hr, Section, Text } from "@react-email/components" import { RavenEmailLayout } from "./_components/layout" import { EMAIL_COLORS } from "./_components/tokens" diff --git a/tests/setup/bun-test-env.ts b/tests/setup/bun-test-env.ts index b527cf9..6d0f2b5 100644 --- a/tests/setup/bun-test-env.ts +++ b/tests/setup/bun-test-env.ts @@ -33,6 +33,14 @@ if (typeof window === "undefined" || typeof document === "undefined") { } } +const globalTarget = globalThis as Record +if (typeof globalTarget.Element === "undefined") { + const win = globalTarget.window as undefined | { Element?: unknown } + if (win?.Element) { + globalTarget.Element = win.Element + } +} + const applyFixedDate = () => { if (fixedTimestamp === null) { globalThis.Date = OriginalDate