11import crypto from 'node:crypto'
2+ import { styleText } from 'node:util'
23import { helmet } from '@nichtsam/helmet/node-http'
34import { createRequestHandler } from '@react-router/express'
45import * as Sentry from '@sentry/node'
56import { ip as ipAddress } from 'address'
6- import chalk from 'chalk'
77import closeWithGrace from 'close-with-grace'
88import compression from 'compression'
99import express from 'express'
@@ -230,9 +230,7 @@ if (!portAvailable && !IS_DEV) {
230230const server = app . listen ( portToUse , ( ) => {
231231 if ( ! portAvailable ) {
232232 console . warn (
233- chalk . yellow (
234- `⚠️ Port ${ desiredPort } is not available, using ${ portToUse } instead.` ,
235- ) ,
233+ styleText ( 'yellow' , `⚠️ Port ${ desiredPort } is not available, using ${ portToUse } instead.` ) ,
236234 )
237235 }
238236 console . log ( `🚀 We have liftoff!` )
@@ -248,9 +246,9 @@ const server = app.listen(portToUse, () => {
248246
249247 console . log (
250248 `
251- ${ chalk . bold ( ' Local:') } ${ chalk . cyan ( localUrl ) }
252- ${ lanUrl ? `${ chalk . bold ( ' On Your Network:') } ${ chalk . cyan ( lanUrl ) } ` : '' }
253- ${ chalk . bold ( 'Press Ctrl+C to stop' ) }
249+ ${ styleText ( 'bold' , ' Local:') } ${ styleText ( 'cyan' , localUrl ) }
250+ ${ lanUrl ? `${ styleText ( 'bold' , ' On Your Network:') } ${ styleText ( 'cyan' , lanUrl ) } ` : '' }
251+ ${ styleText ( 'bold' , 'Press Ctrl+C to stop' ) }
254252 ` . trim ( ) ,
255253 )
256254} )
@@ -260,8 +258,8 @@ closeWithGrace(async ({ err }) => {
260258 server . close ( ( e ) => ( e ? reject ( e ) : resolve ( 'ok' ) ) )
261259 } )
262260 if ( err ) {
263- console . error ( chalk . red ( err ) )
264- console . error ( chalk . red ( err . stack ) )
261+ console . error ( styleText ( ' red' , String ( err ) ) )
262+ console . error ( styleText ( ' red' , String ( err . stack ) ) )
265263 if ( SENTRY_ENABLED ) {
266264 Sentry . captureException ( err )
267265 await Sentry . flush ( 500 )
0 commit comments