@nu-art/commando
Version:
Shell command execution framework with interactive sessions, CLI parameter resolution, and plugin system for building and executing shell scripts programmatically
77 lines (76 loc) • 2.58 kB
TypeScript
import { Logger } from '@nu-art/ts-common';
import { Commando_NVM } from '../plugins/nvm.js';
/**
* NVM (Node Version Manager) service for managing Node.js installations.
*
* Handles installation, version management, and configuration of NVM.
* Works with Commando_NVM plugin to execute NVM commands.
*
* **Features**:
* - Install/uninstall NVM
* - Configure shell RC files (.bashrc, .zshrc)
* - Version management
* - Integration with .nvmrc files
*/
export declare class Cli_NVM extends Logger {
private _expectedVersion;
private _homeEnvVar;
constructor();
get homeEnvVar(): string;
set homeEnvVar(value: string);
get expectedVersion(): string;
set expectedVersion(value: string);
/**
* Installs NVM and configures shell RC files.
*
* **Behavior**:
* - Checks if NVM is already installed with expected version
* - Uninstalls if version mismatch
* - Installs NVM via Commando_NVM
* - Configures .bashrc with NVM initialization (if not already present)
*
*
* @param commando - Commando_NVM instance to use for installation
* @returns This instance for method chaining
*/
install: (commando: Commando_NVM) => Promise<this | undefined>;
/**
* Checks if NVM is installed.
*
* Verifies both environment variable and directory existence.
*
* @returns True if NVM is installed
*/
isInstalled: () => boolean;
/**
* Reads the required Node.js version from .nvmrc file.
*
* @returns Promise resolving to version string from .nvmrc
* @throws Error if .nvmrc file doesn't exist
*/
getRequiredNode_Version: () => Promise<string>;
/**
* Installs required Node.js version if not already installed.
*
* Reads .nvmrc, checks installed versions, and installs if missing.
*
* @param commando - Commando_NVM instance to use
* @returns True if version was installed, false if already present
*/
installRequiredVersionIfNeeded: (commando: Commando_NVM) => Promise<boolean>;
/**
* Uninstalls NVM by removing its directory.
*
* @returns Promise that resolves when uninstall completes
*/
uninstall: () => Promise<void>;
/**
* Installs a specific Node.js version via NVM.
*
* @param commando - Commando_NVM instance to use
* @param requiredVersion - Optional version (defaults to .nvmrc value)
* @returns Promise that resolves when installation completes
*/
private installVersion;
}
export declare const NVM: Cli_NVM;