Skip to content

Commit 1fac9b4

Browse files
committed
add file extension filter
1 parent 4130a2a commit 1fac9b4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

bin/vue-codemod.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,17 @@ async function main() {
3737

3838
log(`Processing ${resolvedPaths.length} files…`)
3939

40+
const extensions = ['.js', '.ts', '.vue', '.jsx', '.tsx']
4041
for (const p of resolvedPaths) {
4142
debug(`Processing ${p}…`)
4243
const fileInfo = {
4344
path: p,
4445
source: fs.readFileSync(p).toString(),
4546
}
47+
const extension = (/\.([^.]*)$/.exec(fileInfo.path) || [])[0]
48+
if (!extensions.includes(extension)){
49+
continue
50+
}
4651
try {
4752
const result = runTransformation(
4853
fileInfo,

0 commit comments

Comments
 (0)