File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -74,8 +74,8 @@ export async function emitDts(
74
74
throw new Error ( 'DTS generation failed' ) ;
75
75
}
76
76
77
- logger . info (
78
- `DTS generation succeeded in ${ getTimeCost ( start ) } ${ color . gray ( `(${ name } )` ) } ` ,
77
+ logger . ready (
78
+ `DTS generated in ${ getTimeCost ( start ) } ${ color . gray ( `(${ name } )` ) } ` ,
79
79
) ;
80
80
} else {
81
81
const createProgram = ts . createSemanticDiagnosticsBuilderProgram ;
Original file line number Diff line number Diff line change @@ -48,8 +48,25 @@ export function getFileLoc(diagnostic: ts.Diagnostic): string {
48
48
return '' ;
49
49
}
50
50
51
+ export const prettyTime = ( seconds : number ) : string => {
52
+ const format = ( time : string ) => color . bold ( time ) ;
53
+
54
+ if ( seconds < 10 ) {
55
+ const digits = seconds >= 0.01 ? 2 : 3 ;
56
+ return `${ format ( seconds . toFixed ( digits ) ) } s` ;
57
+ }
58
+
59
+ if ( seconds < 60 ) {
60
+ return `${ format ( seconds . toFixed ( 1 ) ) } s` ;
61
+ }
62
+
63
+ const minutes = seconds / 60 ;
64
+ return `${ format ( minutes . toFixed ( 2 ) ) } m` ;
65
+ } ;
66
+
51
67
export function getTimeCost ( start : number ) : string {
52
- return `${ Math . floor ( Date . now ( ) - start ) } ms` ;
68
+ const second = ( Date . now ( ) - start ) / 1000 ;
69
+ return prettyTime ( second ) ;
53
70
}
54
71
55
72
export async function processDtsFiles (
You can’t perform that action at this time.
0 commit comments