@@ -2,7 +2,7 @@ import path from 'path';
2
2
3
3
import chalk from 'chalk' ;
4
4
import figures from 'figures' ;
5
- import { table } from 'table' ;
5
+ import textTable from 'text- table' ;
6
6
import prettyTime from 'pretty-time' ;
7
7
8
8
import getDescription from './description' ;
@@ -101,13 +101,19 @@ export const formatRequest = (request) => {
101
101
return `${ loaders } ${ NEXT } ${ request . file } ` ;
102
102
} ;
103
103
104
+ function createTable ( data ) {
105
+ return textTable ( data , {
106
+ align : data [ 0 ] . map ( ( ) => 'l' ) ,
107
+ } ) . replace ( / \n / g, '\n\n' ) ;
108
+ }
109
+
104
110
export const formatStats = ( allStats ) => {
105
111
const lines = [ ] ;
106
112
107
113
Object . keys ( allStats ) . forEach ( ( category ) => {
108
114
const stats = allStats [ category ] ;
109
115
110
- lines . push ( `Stats by ${ chalk . bold ( startCase ( category ) ) } ` ) ;
116
+ lines . push ( `> Stats by ${ chalk . bold ( startCase ( category ) ) } ` ) ;
111
117
112
118
let totalRequests = 0 ;
113
119
const totalTime = [ 0 , 0 ] ;
@@ -139,10 +145,10 @@ export const formatStats = (allStats) => {
139
145
140
146
data . push ( [ 'Total' , totalRequests , prettyTime ( totalTime ) , '' , '' ] ) ;
141
147
142
- lines . push ( table ( data ) ) ;
148
+ lines . push ( createTable ( data ) ) ;
143
149
} ) ;
144
150
145
- return lines . join ( '\n\n' ) ;
151
+ return ` ${ lines . join ( '\n\n' ) } \n` ;
146
152
} ;
147
153
148
154
export function ellipsis ( str , n ) {
0 commit comments