@@ -6,6 +6,7 @@ import Module from 'module'
6
6
7
7
import * as yargs from 'yargs'
8
8
import * as globby from 'globby'
9
+ import * as util from 'util'
9
10
10
11
import createDebug from 'debug'
11
12
import { question } from 'readline-sync'
@@ -21,6 +22,7 @@ import type { TransformationModule } from '../src/runTransformation'
21
22
22
23
const debug = createDebug ( 'vue-codemod' )
23
24
const log = console . log . bind ( console )
25
+ let processFilePath : string [ ] = [ ]
24
26
25
27
const {
26
28
_ : files ,
@@ -61,9 +63,10 @@ const {
61
63
// TODO: port the `Runner` interface of jscodeshift
62
64
async function main ( ) {
63
65
// Remind user to back up files
64
- const answer = question ( 'Warning!!\n ' +
65
- 'This tool may overwrite files.\n' +
66
- 'Enter yes to continue:'
66
+ const answer = question (
67
+ 'Warning!!\n ' +
68
+ 'This tool may overwrite files.\n' +
69
+ 'Enter yes to continue:'
67
70
)
68
71
if ( answer . trim ( ) !== 'yes' ) {
69
72
return
@@ -94,6 +97,10 @@ async function main() {
94
97
}
95
98
packageTransform ( )
96
99
}
100
+ const processFilePathList = processFilePath . join ( '\n' )
101
+ console . log ( `--------------------------------------------------` )
102
+ console . log ( `Processed file:\n${ processFilePathList } ` )
103
+ console . log ( `Processed ${ processFilePath . length } files` )
97
104
}
98
105
/**
99
106
* process files by Transformation
@@ -106,9 +113,7 @@ function processTransformation(
106
113
transformationName : string ,
107
114
transformationModule : TransformationModule
108
115
) {
109
- log (
110
- `Processing ${ resolvedPaths . length } files… use ${ transformationName } transformation`
111
- )
116
+ log ( `Processing use ${ transformationName } transformation` )
112
117
113
118
const extensions = [ '.js' , '.ts' , '.vue' , '.jsx' , '.tsx' ]
114
119
for ( const p of resolvedPaths ) {
@@ -129,6 +134,9 @@ function processTransformation(
129
134
params as object
130
135
)
131
136
fs . writeFileSync ( p , result )
137
+ if ( util . inspect ( processFilePath ) . indexOf ( util . inspect ( p ) ) == - 1 ) {
138
+ processFilePath . push ( p )
139
+ }
132
140
} catch ( e ) {
133
141
console . error ( e )
134
142
}
0 commit comments