Skip to content

Commit

Permalink
chore: 优化扩展名判断
Browse files Browse the repository at this point in the history
  • Loading branch information
jaw52 committed Mar 6, 2023
1 parent e2bd174 commit 912f947
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/transformStart.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'fs'
import { rename } from 'node:fs/promises'
import { extname } from 'path'
import * as parser from '@babel/parser'
import _traverse from '@babel/traverse'
import consola from 'consola'
Expand All @@ -14,7 +15,7 @@ import { formatMs } from './utils/formatTime'
const traverse = (_traverse as any).default as typeof _traverse

const runRename = async (oldPath: string, isGitMv: 1 | 0) => {
const target = oldPath.includes('.js')
const target = extname(oldPath) === '.js'
? oldPath.replace(/.js$/, '.jsx')
: oldPath.replace(/.ts$/, '.tsx')

Expand Down

0 comments on commit 912f947

Please sign in to comment.