UNPKG

@reliverse/rse-sdk

Version:

@reliverse/rse-sdk allows you to create new plugins for @reliverse/rse CLI, interact with reliverse.org, and even extend your own CLI functionality (you may also try @reliverse/dler-sdk for this case).

22 lines (21 loc) 734 B
import { relinka } from "@reliverse/relinka"; import { execaCommand } from "execa"; export async function runCodemods(names, options) { for (const name of names) { relinka("info", ` Applying codemod: ${name}`); const cmdArgs = [name]; if (options.dry) cmdArgs.push("--dry"); if (options.format) cmdArgs.push("--format"); if (options.include) cmdArgs.push("-i", options.include); if (options.exclude) cmdArgs.push("-e", options.exclude); try { await execaCommand(`codemod ${cmdArgs}`, { stdio: "inherit" }); relinka("info", `Successfully ran codemod: ${name} `); } catch (error) { relinka("error", `Failed to run codemod: ${name}`, String(error)); process.exit(1); } } }