codemods: default to running codemon on current dir
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -36,7 +36,7 @@ export function createCodemodAction(name: string) {
|
||||
'--transform',
|
||||
transformPath,
|
||||
'--ignore-pattern=**/node_modules/**',
|
||||
...cmd.args,
|
||||
...(cmd.args.length ? cmd.args : ['.']),
|
||||
];
|
||||
|
||||
console.log(`Running jscodeshift with these arguments: ${args.join(' ')}`);
|
||||
|
||||
@@ -25,12 +25,14 @@ async function main(argv: string[]) {
|
||||
program.name('backstage-codemods').version(version);
|
||||
|
||||
const applyCommand = program
|
||||
.command('apply <codemod> <target-dirs...>')
|
||||
.description('Apply a codemod to target directories');
|
||||
.command('apply <codemod> [<target-dirs...>]')
|
||||
.description(
|
||||
'Apply a codemod to target directories, defaulting to the current directory',
|
||||
);
|
||||
|
||||
for (const codemod of codemods) {
|
||||
applyCommand
|
||||
.command(`${codemod.name} <target-dirs...>`)
|
||||
.command(`${codemod.name} [<target-dirs...>]`)
|
||||
.description(codemod.description)
|
||||
.option('-d, --dry', 'Dry run, no changes written to files')
|
||||
.action(createCodemodAction(codemod.name));
|
||||
|
||||
Reference in New Issue
Block a user