Skip to content

Commit

Permalink
Merge pull request #205 from oceanbase/dengfuping-codemod
Browse files Browse the repository at this point in the history
fix(codemod): dir arg should limit transform scope
  • Loading branch information
dengfuping committed Oct 23, 2023
2 parents 1138341 + 500689f commit 24811c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test:update": "NODE_OPTIONS=--max_old_space_size=4096 cross-env TZ=UTC jest --updateSnapshot",
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx",
"lint:fix": "eslint --cache --ext .js,.jsx,.ts,.tsx --fix --format=pretty",
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
"prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,less,md,json}\"",
"tsc": "tsc --noEmit",
"tsc:clean": "tsc --build --clean",
"locale:remove-useless": "ts-node scripts/remove-useless-locale.ts"
Expand Down
3 changes: 1 addition & 2 deletions packages/codemod/bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const _ = require('lodash');
const chalk = require('chalk');
const isGitClean = require('is-git-clean');
const updateCheck = require('update-check');
const findUp = require('find-up');
const semver = require('semver');
const { run: jscodeshift } = require('jscodeshift/src/Runner');
const execa = require('execa');
Expand Down Expand Up @@ -286,7 +285,7 @@ async function bootstrap() {
console.log('[Prettier] format files running...');
try {
const isDir = isDirectory.sync(dir);
const path = isDir ? '**/*.{js,jsx,tsx,ts,d.ts}' : dir;
const path = 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' });
console.log('\n[Prettier] format files completed!\n');
Expand Down

0 comments on commit 24811c3

Please sign in to comment.