Skip to content

Commit d45eac2

Browse files
authored
[CLI] feat: ask if user wants to run all the recipe codemods (CDMD-3415) (#659)
1 parent ab929c5 commit d45eac2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

apps/cli/src/downloadCodemod.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
parseCodemodConfig,
1010
} from "@codemod-com/utilities";
1111
import type { TarService } from "@codemod-com/utilities";
12+
import inquirer from "inquirer";
1213
import type { Ora } from "ora";
1314
import { getCodemodDownloadURI } from "./apis.js";
1415
import type { FileDownloadServiceBlueprint } from "./fileDownloadService.js";
@@ -168,6 +169,27 @@ export class CodemodDownloader implements CodemodDownloaderBlueprint {
168169
if (config.engine === "recipe") {
169170
const codemods: Codemod[] = [];
170171

172+
const { runAll } = await inquirer.prompt<{ runAll: boolean }>({
173+
name: "runAll",
174+
type: "confirm",
175+
message:
176+
"The codemod you are trying to run is a recipe. Do you wish to run all of them?",
177+
default: true,
178+
});
179+
180+
if (!runAll) {
181+
const { names } = await inquirer.prompt<{ names: string[] }>({
182+
name: "names",
183+
type: "checkbox",
184+
message:
185+
"Please select the codemods you want to run (use space and arrow keys to select)",
186+
choices: config.names,
187+
default: config.names,
188+
});
189+
190+
config.names = names;
191+
}
192+
171193
for (const name of config.names) {
172194
const codemod = await this.download(name);
173195
codemods.push(codemod);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy