File tree Expand file tree Collapse file tree
packages/@tailwindcss-cli/src/commands/build Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,9 +77,13 @@ async function handleError<T>(fn: () => T): Promise<T> {
7777 try {
7878 return await fn ( )
7979 } catch ( err ) {
80- if ( err instanceof Error ) {
81- eprintln ( err . toString ( ) )
82- }
80+ eprintln (
81+ [ red ( 'Error:' ) , dim ( '\u250C' ) ]
82+ . concat ( `${ err } ` . split ( '\n' ) . map ( ( line ) => `${ dim ( '\u2502' ) } ${ line } ` ) )
83+ . concat ( dim ( '\u2514' ) )
84+ . join ( '\n' ) ,
85+ )
86+
8387 process . exit ( 1 )
8488 }
8589}
@@ -374,9 +378,14 @@ export async function handle(args: Result<ReturnType<typeof options>>) {
374378 } catch ( err ) {
375379 // Catch any errors and print them to stderr, but don't exit the process
376380 // and keep watching.
377- if ( err instanceof Error ) {
378- eprintln ( err . toString ( ) )
379- }
381+ eprintln (
382+ [ red ( 'Error:' ) , dim ( '\u250C' ) ]
383+ . concat ( `${ err } ` . split ( '\n' ) . map ( ( line ) => `${ dim ( '\u2502' ) } ${ line } ` ) )
384+ . concat ( dim ( '\u2514' ) )
385+ . join ( '\n' ) ,
386+ )
387+
388+ if ( ! args [ '--silent' ] ) eprintln ( `Done in ${ formatDuration ( end - start ) } ` )
380389 }
381390 } ) ,
382391 )
@@ -516,3 +525,11 @@ async function createWatchers(dirs: string[], cb: (files: string[]) => void) {
516525function watchDirectories ( scanner : Scanner ) {
517526 return [ ...new Set ( scanner . normalizedSources . flatMap ( ( globEntry ) => globEntry . base ) ) ]
518527}
528+
529+ function dim ( str : string ) {
530+ return `\x1B[2m${ str } \x1B[22m`
531+ }
532+
533+ function red ( str : string ) {
534+ return `\x1B[31m${ str } \x1B[39m`
535+ }
You can’t perform that action at this time.
0 commit comments