@@ -10,7 +10,7 @@ import type {
10
10
} from './types'
11
11
import { existsSync } from 'node:fs'
12
12
import { isAbsolute , join } from 'node:path'
13
- import chalk from 'chalk '
13
+ import { colorize } from 'consola/utils '
14
14
import { defu } from 'defu'
15
15
import fs from 'fs-extra'
16
16
import { createHooks } from 'hookable'
@@ -329,7 +329,7 @@ export async function createUnlighthouse(userConfig: UserConfig, provider?: Prov
329
329
330
330
if ( provider ?. name !== 'ci' ) {
331
331
// fancy CLI banner when we start
332
- const label = ( name : string ) => chalk . bold . magenta ( `▸ ${ name } :` )
332
+ const label = ( name : string ) => colorize ( ' bold' , colorize ( ' magenta' , ( `▸ ${ name } :` ) ) )
333
333
let mode = ''
334
334
if ( resolvedConfig . urls ?. length )
335
335
mode = 'Manual'
@@ -347,35 +347,35 @@ export async function createUnlighthouse(userConfig: UserConfig, provider?: Prov
347
347
catch ( e ) { }
348
348
349
349
const title = [
350
- `⛵ ${ chalk . bold . blueBright ( AppName ) } ${ chalk . dim ( `${ provider ?. name } @ v${ version } ` ) } ` ,
350
+ `⛵ ${ colorize ( ' bold' , colorize ( 'blueBright' , AppName ) ) } ${ colorize ( 'dim' , `${ provider ?. name } @ v${ version } ` ) } ` ,
351
351
]
352
352
if ( Number ( latestTag . replace ( 'v' , '' ) . replace ( '.' , '' ) ) > Number ( version . replace ( '.' , '' ) ) ) {
353
353
title . push ( ...[
354
354
'' ,
355
355
`🎉 New version ${ latestTag } available! Use the latest:` ,
356
- chalk . gray ( ` > ${ chalk . underline ( `npx unlighthouse@^${ latestTag } --site ${ resolvedConfig . site } ` ) } ` ) ,
356
+ colorize ( 'gray' , ` > ${ colorize ( 'underline' , `npx unlighthouse@^${ latestTag } --site ${ resolvedConfig . site } ` ) } ` ) ,
357
357
] )
358
358
}
359
359
title . push ( ...[
360
360
'' ,
361
361
`${ label ( 'Scanning' ) } ${ resolvedConfig . site } ` ,
362
- `${ label ( 'Route Discovery' ) } ${ mode } ${ ctx . routes . length > 1 ? ( chalk . dim ( `${ ctx . routes . length } initial URLs` ) ) : '' } ` ,
362
+ `${ label ( 'Route Discovery' ) } ${ mode } ${ ctx . routes . length > 1 ? ( colorize ( ' dim' , ( `${ ctx . routes . length } initial URLs` ) ) ) : '' } ` ,
363
363
'' ,
364
- chalk . dim ( ' 💖 Like Unlighthouse? Support the development: https://github.com/sponsors/harlan-zw' ) ,
364
+ colorize ( ' dim' , ( ' 💖 Like Unlighthouse? Support the development: https://github.com/sponsors/harlan-zw' ) ) ,
365
365
] )
366
366
if ( ctx . routeDefinitions ?. length )
367
367
title . push ( `${ label ( 'Route Definitions' ) } ${ ctx . routeDefinitions . length } ` )
368
368
369
369
process . stdout . write ( successBox (
370
370
// messages
371
371
[
372
- ctx . runtimeSettings . clientUrl ? chalk . whiteBright ( `Report: ${ ctx . runtimeSettings . clientUrl } ` ) : '' ,
372
+ ctx . runtimeSettings . clientUrl ? colorize ( 'whiteBright' , `Report: ${ ctx . runtimeSettings . clientUrl } ` ) : '' ,
373
373
] . join ( '\n' ) ,
374
374
// title
375
375
title . join ( '\n' ) ,
376
376
) )
377
377
if ( existsSync ( join ( ctx . runtimeSettings . generatedClientPath , 'reports' , 'lighthouse.json' ) ) && ctx . resolvedConfig . cache )
378
- logger . info ( `Restoring reports from cache. ${ chalk . gray ( 'You can disable this behavior by passing --no-cache.' ) } ` )
378
+ logger . info ( `Restoring reports from cache. ${ colorize ( 'gray' , 'You can disable this behavior by passing --no-cache.' ) } ` )
379
379
}
380
380
return ctx
381
381
}
0 commit comments