UNPKG

@elsikora/setup-wizard

Version:

Setup Wizard - CLI scaffolding utility

31 lines (30 loc) 1.47 kB
import type { ICliInterfaceService } from "../../application/interface/cli-interface-service.interface"; import type { ICommandService } from "../../application/interface/command-service.interface"; /** * Implementation of the command service using Node.js child_process. * Provides functionality to execute shell commands. */ export declare class NodeCommandService implements ICommandService { /** CLI interface service for user interaction */ readonly CLI_INTERFACE_SERVICE: ICliInterfaceService; /** * Promisified version of the exec function from child_process. * Allows for async/await usage of command execution. */ private readonly EXEC_ASYNC; constructor(cliInterfaceService: ICliInterfaceService); /** * Executes a shell command. * @param command - The shell command to execute * @returns Promise that resolves when the command completes successfully * @throws Will throw an error if the command execution fails, except for npm install which offers retry options */ execute(command: string): Promise<void>; /** * Handles npm install command failures by offering retry options to the user. * @param originalCommand - The original npm command that failed * @returns Promise that resolves when the chosen action completes * @throws Will throw an error if the user chooses to cancel or if retried command still fails */ private handleNpmInstallFailure; }