Skip to content

Commit

Permalink
fix(codemod): path => targetPath to avoid duplicate name when prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
dengfuping committed Oct 29, 2023
1 parent 454be20 commit c06bd88
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/codemod/bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ async function bootstrap() {
console.log('[Prettier] format files running...');
try {
const isDir = isDirectory.sync(dir);
const path = isDir ? path.join(dir, '**/*.{js,jsx,ts,tsx,d.ts}') : dir;
const targetPath = isDir ? path.join(dir, '**/*.{js,jsx,ts,tsx,d.ts}') : dir;
const npxCommand = commandExistsSync('tnpx') ? 'tnpx' : 'npx';
await execa(npxCommand, ['prettier', '--write', path], { stdio: 'inherit' });
await execa(npxCommand, ['prettier', '--write', targetPath], { stdio: 'inherit' });
console.log('\n[Prettier] format files completed!\n');
} catch (err) {
console.log('\n[Prettier] format files failed, please format it by yourself.\n', err);
Expand Down

0 comments on commit c06bd88

Please sign in to comment.