@capgo/cli
Version:
A CLI to upload to capgo servers
38 lines (37 loc) • 2.13 kB
TypeScript
import type { PackageManagerRunner, PackageManagerType } from '@capgo/find-package-manager';
import type { ChildProcess } from 'node:child_process';
import { findInstallCommand } from '@capgo/find-package-manager';
export type SupportedPackageManager = Exclude<PackageManagerType, 'unknown'>;
export interface PackageManagerInfo {
pm: SupportedPackageManager;
command: ReturnType<typeof findInstallCommand>;
installCommand: string;
runner: PackageManagerRunner;
}
export interface ExecutableProbeOptions {
args?: string[];
cwd?: string;
env?: NodeJS.ProcessEnv;
timeoutMs?: number;
}
export interface ExecutableProbeResult {
available: boolean;
error?: NodeJS.ErrnoException;
status?: number | null;
stdout?: string;
}
export interface CommandResult {
success: boolean;
error?: Error;
}
export declare function createMissingExecutableError(command: string, executablePath?: string): NodeJS.ErrnoException;
export declare function preparePackageManagerCommandEnvironment(environment?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
export declare function probeExecutable(command: string, options?: ExecutableProbeOptions): ExecutableProbeResult;
export declare function supportsYarnDlx(version: string): boolean;
export declare function probePackageManagerCommand(commandLine: string, options?: ExecutableProbeOptions): ExecutableProbeResult;
export declare function resolveExecutableProbeError(command: string, probe: ExecutableProbeResult): Error;
export declare function getAvailablePackageManagers(detected: SupportedPackageManager, isAvailable?: (command: string) => boolean): SupportedPackageManager[];
export declare function getPackageManagerInfo(pm: SupportedPackageManager): PackageManagerInfo;
export declare function isPackageManagerAvailable(pm: SupportedPackageManager, isAvailable?: (command: string) => boolean): boolean;
export declare function getMissingPackageManagerExecutable(pm: SupportedPackageManager, isAvailable?: (command: string) => boolean): string | undefined;
export declare function waitForCommandResult(child: ChildProcess): Promise<CommandResult>;