File tree Expand file tree Collapse file tree 4 files changed +16
-13
lines changed Expand file tree Collapse file tree 4 files changed +16
-13
lines changed Original file line number Diff line number Diff line change 11import { PassThrough } from 'stream'
2+ import { styleText } from 'node:util'
23import {
34 createReadableStreamFromReadable ,
45 type LoaderFunctionArgs ,
78} from '@remix-run/node'
89import { RemixServer } from '@remix-run/react'
910import * as Sentry from '@sentry/remix'
10- import chalk from 'chalk'
1111import { isbot } from 'isbot'
1212import { renderToPipeableStream } from 'react-dom/server'
1313import { getEnv , init } from './utils/env.server.ts'
@@ -102,15 +102,15 @@ export function handleError(
102102 return
103103 }
104104 if ( error instanceof Error ) {
105- console . error ( chalk . red ( error . stack ) )
105+ console . error ( styleText ( ' red' , String ( error . stack ) ) )
106106 void Sentry . captureRemixServerException (
107107 error ,
108108 'remix.server' ,
109109 request ,
110110 true ,
111111 )
112112 } else {
113- console . error ( chalk . red ( error ) )
113+ console . error ( styleText ( ' red' , String ( error ) ) )
114114 Sentry . captureException ( error )
115115 }
116116}
Original file line number Diff line number Diff line change 1+ import { styleText } from 'node:util'
12import { remember } from '@epic-web/remember'
23import { PrismaClient } from '@prisma/client'
3- import chalk from 'chalk'
44
55export const prisma = remember ( 'prisma' , ( ) => {
66 // NOTE: if you change anything in this function you'll need to restart
@@ -28,7 +28,8 @@ export const prisma = remember('prisma', () => {
2828 : e . duration < logThreshold * 1.4
2929 ? 'redBright'
3030 : 'red'
31- const dur = chalk [ color ] ( `${ e . duration } ms` )
31+ const dur = styleText ( color , `${ e . duration } ms` )
32+
3233 console . info ( `prisma:query - ${ dur } - ${ e . query } ` )
3334 } )
3435 void client . $connect ( )
Original file line number Diff line number Diff line change 11import 'dotenv/config'
2+ // 👆 this needs to imported first
3+
4+ import { styleText } from 'node:util'
25import * as fs from 'fs'
3- import chalk from 'chalk'
46import closeWithGrace from 'close-with-grace'
57import sourceMapSupport from 'source-map-support'
68
@@ -20,8 +22,8 @@ sourceMapSupport.install({
2022
2123closeWithGrace ( async ( { err } ) => {
2224 if ( err ) {
23- console . error ( chalk . red ( err ) )
24- console . error ( chalk . red ( err . stack ) )
25+ console . error ( styleText ( 'red' , err . message ) )
26+ console . error ( styleText ( ' red' , String ( err . stack ) ) )
2527 process . exit ( 1 )
2628 }
2729} )
Original file line number Diff line number Diff line change 11import crypto from 'crypto'
2+ import { styleText } from 'node:util'
23import { createRequestHandler } from '@remix-run/express'
34import { type ServerBuild , installGlobals } from '@remix-run/node'
45import { ip as ipAddress } from 'address'
5- import chalk from 'chalk'
66import closeWithGrace from 'close-with-grace'
77import compression from 'compression'
88import express from 'express'
@@ -239,7 +239,7 @@ if (!portAvailable && !IS_DEV) {
239239const server = app . listen ( portToUse , ( ) => {
240240 if ( ! portAvailable ) {
241241 console . warn (
242- chalk . yellow (
242+ styleText ( 'yellow' ,
243243 `⚠️ Port ${ desiredPort } is not available, using ${ portToUse } instead.` ,
244244 ) ,
245245 )
@@ -257,9 +257,9 @@ const server = app.listen(portToUse, () => {
257257
258258 console . log (
259259 `
260- ${ chalk . bold ( ' Local:') } ${ chalk . cyan ( localUrl ) }
261- ${ lanUrl ? `${ chalk . bold ( ' On Your Network:') } ${ chalk . cyan ( lanUrl ) } ` : '' }
262- ${ chalk . bold ( 'Press Ctrl+C to stop' ) }
260+ ${ styleText ( 'bold' , ' Local:') } ${ styleText ( 'cyan' , localUrl ) }
261+ ${ lanUrl ? `${ styleText ( 'bold' , ' On Your Network:') } ${ styleText ( 'cyan' , lanUrl ) } ` : '' }
262+ ${ styleText ( 'bold' , 'Press Ctrl+C to stop' ) }
263263 ` . trim ( ) ,
264264 )
265265} )
You can’t perform that action at this time.
0 commit comments