@@ -6,7 +6,7 @@ export const cliInstance = new cliProgress.SingleBar(
6
6
format : 'progress [{bar}] {percentage}% | {process} | {value}/{total}' ,
7
7
clearOnComplete : false ,
8
8
linewrap : true ,
9
- fps : 60
9
+ fps : 144
10
10
} ,
11
11
cliProgress . Presets . shades_classic
12
12
)
@@ -98,11 +98,23 @@ export function formatterOutput(
98
98
: ( ( 100 * totalChanged ) / totalDetected ) . toFixed ( 2 )
99
99
100
100
console . log ( `\x1B[0m--------------------------------------------------` )
101
- console . log ( `Processed file:\n${ processFilePathList } ` )
102
- console . log ( `Processed ${ processFilePath . length } files` )
101
+ console . log (
102
+ `Processed ${ processFilePath . length } files:\n${ processFilePathList } \n`
103
+ )
104
+
105
+ if ( global . manualList . length ) {
106
+ console . log (
107
+ `The list that you need to migrate your codes manually (total: ${ global . manualList . length } ): `
108
+ )
109
+ let index = 1
110
+ global . manualList . forEach ( manual => {
111
+ console . log ( 'index:' , index ++ )
112
+ console . log ( manual )
113
+ } )
114
+ }
103
115
104
116
console . log (
105
- '\x1B[31;4m%s\x1B[0m' ,
117
+ '\n\n\ x1B[31;4m%s\x1B[0m' ,
106
118
`${ totalDetected } places` ,
107
119
`need to be transformed`
108
120
)
@@ -113,56 +125,38 @@ export function formatterOutput(
113
125
)
114
126
console . log ( `The transformation rate is \x1B[32;4m${ transRate } %\x1B[0m` )
115
127
116
- if ( formatter === 'all' ) {
117
- console . log ( 'The transformation stats: \n' )
118
- console . log ( global . outputReport )
119
- }
120
-
121
128
Object . keys ( outputReport ) . forEach ( item => {
122
129
if ( ! outputReport [ item ] ) delete outputReport [ item ]
123
130
} )
124
131
125
132
if ( formatter === 'detail' ) {
126
133
console . log ( 'The transformation stats: \n' )
127
134
console . log ( global . outputReport )
128
- }
129
-
130
- let tableStr : string
131
- let tableOutput : any [ ] [ ] = [ [ 'Rule Names' , 'Count' ] ]
132
- for ( let i in global . outputReport ) {
133
- tableOutput . push ( [ i , global . outputReport [ i ] ] )
134
- }
135
- tableStr = table ( tableOutput , {
136
- drawHorizontalLine : ( lineIndex , rowCount ) => {
137
- return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount
138
- } ,
139
- columns : [ { alignment : 'left' } , { alignment : 'center' } ]
140
- } )
141
-
142
- if ( formatter === 'table' ) {
143
- console . log ( 'The transformation stats: \n' )
144
- console . log ( tableStr )
145
- }
146
-
147
- if ( formatter === 'log' ) {
148
- logOutput (
149
- processFilePathList ,
150
- processFilePath ,
151
- totalDetected ,
152
- totalChanged ,
153
- transRate ,
154
- tableStr ,
155
- logger
156
- )
157
- }
158
-
159
- if ( global . manualList . length ) {
160
- console . log ( 'The list that you need to migrate your codes manually: ' )
161
- let index = 1
162
- global . manualList . forEach ( manual => {
163
- console . log ( 'index:' , index ++ )
164
- console . log ( manual )
135
+ } else {
136
+ let tableStr : string
137
+ let tableOutput : any [ ] [ ] = [ [ 'Rule Names' , 'Count' ] ]
138
+ for ( let i in global . outputReport ) {
139
+ tableOutput . push ( [ i , global . outputReport [ i ] ] )
140
+ }
141
+ tableStr = table ( tableOutput , {
142
+ drawHorizontalLine : ( lineIndex , rowCount ) => {
143
+ return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount
144
+ } ,
145
+ columns : [ { alignment : 'left' } , { alignment : 'center' } ]
165
146
} )
147
+ console . log ( 'The transformation stats: ' )
148
+ console . log ( tableStr )
149
+ if ( formatter === 'log' ) {
150
+ logOutput (
151
+ processFilePathList ,
152
+ processFilePath ,
153
+ totalDetected ,
154
+ totalChanged ,
155
+ transRate ,
156
+ tableStr ,
157
+ logger
158
+ )
159
+ }
166
160
}
167
161
}
168
162
@@ -175,14 +169,9 @@ export function logOutput(
175
169
tableStr : string ,
176
170
logger : Console
177
171
) {
178
- logger . log ( `--------------------------------------------------` )
179
- logger . log ( `Processed file:\n${ processFilePathList } \n` )
180
- logger . log ( `Processed ${ processFilePath . length } files` )
181
- logger . log ( `${ totalDetected } places` , `need to be transformed` )
182
- logger . log ( `${ totalChanged } places` , `was transformed` )
183
- logger . log ( `The transformation rate is ${ transRate } %` )
184
- logger . log ( 'The transformation stats: \n' )
185
- logger . log ( tableStr )
172
+ logger . log (
173
+ `Processed ${ processFilePath . length } files:\n${ processFilePathList } \n`
174
+ )
186
175
if ( global . manualList . length ) {
187
176
logger . log ( 'The list that you need to migrate your codes manually' )
188
177
let index = 1
@@ -191,4 +180,9 @@ export function logOutput(
191
180
logger . log ( manual )
192
181
} )
193
182
}
183
+ logger . log ( `\n\n${ totalDetected } places` , `need to be transformed` )
184
+ logger . log ( `${ totalChanged } places` , `was transformed` )
185
+ logger . log ( `The transformation rate is ${ transRate } %` )
186
+ logger . log ( 'The transformation stats: ' )
187
+ logger . log ( tableStr )
194
188
}
0 commit comments