@elsikora/setup-wizard
Version:
Setup Wizard - CLI scaffolding utility
50 lines • 2.14 kB
TypeScript
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>;
/**
* Formats and outputs npm error in readable format.
* @param command - The original npm command that failed
* @param error - npm error object
* @returns void
*/
private formatAndParseNpmError;
/**
* 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;
/**
* Determines whether command is npm package management command.
* @param command - The command to check
* @returns True if command is supported npm command
*/
private isNpmCommand;
/**
* Parses npm error output to structured information.
* @param stderr - npm stderr output
* @returns Parsed npm error details
*/
private parseNpmError;
}
//# sourceMappingURL=node-command.service.d.ts.map