Skip to content

Commit

Permalink
refactor: make codemod accept only one directory or file per run
Browse files Browse the repository at this point in the history
  • Loading branch information
massao committed Jun 17, 2024
1 parent cec812d commit b8af06d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/forma-36-codemod/bin/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export function run() {
type: 'list',
name: 'setup',
message: `Which codemod you would like to use?`,
when: false,
pageSize: inquirerChoices.SETUP_CHOICES.length,
choices: inquirerChoices.SETUP_CHOICES,
},
Expand All @@ -162,15 +163,11 @@ export function run() {
const { files, parser, setup } = answers;

const filesBeforeExpansion = path || files;
const filesExpanded = expandFilePathsIfNeeded(
filesBeforeExpansion.split(' '),
);
const filesExpanded = expandFilePathsIfNeeded([filesBeforeExpansion]);
const selectedParser = cli.flags.parser || parser;

if (!filesExpanded.length) {
console.log(
`No files found matching ${filesBeforeExpansion.join(' ')}`,
);
console.log(`No files found matching ${filesBeforeExpansion}`);
return null;
}

Expand Down

0 comments on commit b8af06d

Please sign in to comment.