@@ -77,9 +77,13 @@ export class DevServer {
77
77
/**
78
78
* Inspect if child process message is from AdonisJS HTTP server
79
79
*/
80
- #isAdonisJSReadyMessage(
81
- message : unknown
82
- ) : message is { isAdonisJS : true ; environment : 'web' ; port : number ; host : string } {
80
+ #isAdonisJSReadyMessage( message : unknown ) : message is {
81
+ isAdonisJS : true
82
+ environment : 'web'
83
+ port : number
84
+ host : string
85
+ duration ?: [ number , number ]
86
+ } {
83
87
return (
84
88
message !== null &&
85
89
typeof message === 'object' &&
@@ -102,7 +106,6 @@ export class DevServer {
102
106
* Starts the HTTP server
103
107
*/
104
108
#startHTTPServer( port : string , mode : 'blocking' | 'nonblocking' ) {
105
- let initialTime = process . hrtime ( )
106
109
this . #httpServer = runNode ( this . #cwd, {
107
110
script : this . #scriptFile,
108
111
env : { PORT : port , ...this . #options. env } ,
@@ -112,10 +115,10 @@ export class DevServer {
112
115
113
116
this . #httpServer. on ( 'message' , ( message ) => {
114
117
if ( this . #isAdonisJSReadyMessage( message ) ) {
115
- const readyAt = process . hrtime ( initialTime )
116
118
const host = message . host === '0.0.0.0' ? '127.0.0.1' : message . host
117
119
118
- ui . sticker ( )
120
+ const displayMessage = ui
121
+ . sticker ( )
119
122
. useColors ( this . #colors)
120
123
. useRenderer ( this . #logger. getRenderer ( ) )
121
124
. add ( `Server address: ${ this . #colors. cyan ( `http://${ host } :${ message . port } ` ) } ` )
@@ -124,8 +127,12 @@ export class DevServer {
124
127
`${ this . #isWatching ? 'enabled' : 'disabled' } `
125
128
) } `
126
129
)
127
- . add ( `Ready in: ${ this . #colors. cyan ( prettyHrtime ( readyAt ) ) } ` )
128
- . render ( )
130
+
131
+ if ( message . duration ) {
132
+ displayMessage . add ( `Ready in: ${ this . #colors. cyan ( prettyHrtime ( message . duration ) ) } ` )
133
+ }
134
+
135
+ displayMessage . render ( )
129
136
}
130
137
} )
131
138
0 commit comments