11import { Command } from 'commander' ;
2- import axios from 'axios' ; // Import axios for HTTP requests
2+ import axios from 'axios' ;
3+ import chalk from 'chalk'
34
45function getSmartUIServerAddress ( ) {
56 const serverAddress = process . env . SMARTUI_SERVER_ADDRESS || 'http://localhost:49152' ;
@@ -13,23 +14,23 @@ command
1314 . description ( 'Ping the SmartUI server to check if it is running' )
1415 . action ( async function ( this : Command ) {
1516 try {
16- console . log ( "Pinging server..." ) ;
17+ console . log ( chalk . yellow ( "Pinging server..." ) ) ;
1718 const serverAddress = getSmartUIServerAddress ( ) ;
18- console . log ( `Pinging server at ${ serverAddress } from terminal...` ) ;
19+ console . log ( chalk . yellow ( `Pinging server at ${ serverAddress } from terminal...` ) ) ;
1920
2021 // Send GET request to the /ping endpoint
2122 const response = await axios . get ( `${ serverAddress } /ping` ) ;
2223
2324 // Log the response from the server
2425 if ( response . status === 200 ) {
25- console . log ( 'SmartUI Server is running' ) ;
26- console . log ( `Response: ${ JSON . stringify ( response . data ) } ` ) ; // Log response data if needed
26+ console . log ( chalk . green ( 'SmartUI Server is running' ) ) ;
27+ console . log ( chalk . green ( `Response: ${ JSON . stringify ( response . data ) } ` ) ) ; // Log response data if needed
2728 } else {
28- console . log ( 'Failed to reach the server' ) ;
29+ console . log ( chalk . red ( 'Failed to reach the server' ) ) ;
2930 }
3031 } catch ( error : any ) {
3132 // Handle any errors during the HTTP request
32- console . error ( 'SmartUI server is not running' , error . message ) ;
33+ console . error ( chalk . red ( 'SmartUI server is not running' ) ) ;
3334 }
3435 } ) ;
3536
0 commit comments