Skip to content

Commit 1e53b4c

Browse files
feat(react-email, preview-server): use styleText from node:util instead of chalk (#2430)
Co-authored-by: Gabriel Miranda <gabrielmfern@outlook.com>
1 parent 799afe0 commit 1e53b4c

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

.changeset/fresh-bees-share.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@react-email/preview-server": patch
3+
"react-email": patch
4+
---
5+
6+
use `styleText` from `node:util` instead of `chalk`

packages/preview-server/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"@types/react-dom": "19.0.4",
3232
"@types/webpack": "5.28.5",
3333
"autoprefixer": "10.4.21",
34-
"chalk": "4.1.2",
3534
"clsx": "2.1.1",
3635
"esbuild": "0.25.0",
3736
"framer-motion": "12.23.12",

packages/preview-server/src/actions/render-email-by-path.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use server';
22
import fs from 'node:fs';
33
import path from 'node:path';
4-
import chalk from 'chalk';
4+
import { styleText } from 'node:util';
55
import logSymbols from 'log-symbols';
66
import ora, { type Ora } from 'ora';
77
import {
@@ -107,11 +107,11 @@ export const renderEmailByPath = async (
107107
const millisecondsToRendered = performance.now() - timeBeforeEmailRendered;
108108
let timeForConsole = `${millisecondsToRendered.toFixed(0)}ms`;
109109
if (millisecondsToRendered <= 450) {
110-
timeForConsole = chalk.green(timeForConsole);
110+
timeForConsole = styleText('green', timeForConsole);
111111
} else if (millisecondsToRendered <= 1000) {
112-
timeForConsole = chalk.yellow(timeForConsole);
112+
timeForConsole = styleText('yellow', timeForConsole);
113113
} else {
114-
timeForConsole = chalk.red(timeForConsole);
114+
timeForConsole = styleText('red', timeForConsole);
115115
}
116116
spinner?.stopAndPersist({
117117
symbol: logSymbols.success,

packages/react-email/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"dependencies": {
3030
"@babel/parser": "^7.27.0",
3131
"@babel/traverse": "^7.27.0",
32-
"chalk": "^5.0.0",
3332
"chokidar": "^4.0.3",
3433
"commander": "^13.0.0",
3534
"debounce": "^2.0.0",

packages/react-email/src/utils/preview/start-dev-server.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import http from 'node:http';
22
import path from 'node:path';
33
import url from 'node:url';
4-
import chalk from 'chalk';
4+
import { styleText } from 'node:util';
55
import { createJiti } from 'jiti';
66
import logSymbols from 'log-symbols';
77
import ora from 'ora';
@@ -85,7 +85,9 @@ export const startDevServer = async (
8585
if (!portAlreadyInUse) {
8686
// this errors when linting but doesn't on the editor so ignore the warning on this
8787
/* eslint-disable-next-line @typescript-eslint/no-unsafe-member-access */
88-
console.log(chalk.greenBright(` React Email ${packageJson.version}`));
88+
console.log(
89+
styleText('greenBright', ` React Email ${packageJson.version}`),
90+
);
8991
console.log(` Running preview at: http://localhost:${port}\n`);
9092
} else {
9193
const nextPortToTry = port + 1;

pnpm-lock.yaml

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)