import { SpawnOptions, SpawnPromise, SpawnResult } from '@expo/spawn-async'; import { PendingSpawnPromise } from './utils/spawn'; export interface PackageManagerOptions extends SpawnOptions { /** * If the package manager should run in silent mode. * Note, this will hide possible error output from executed commands. * When running in silent mode, make sure you handle them properly. */ silent?: boolean; /** * The logging method used to communicate the command which is executed. * Without `silent`, this defaults to `console.log`. * When `silent` is set to `true`, this defaults to a no-op. */ log?: (...args: any[]) => void; } export interface PackageManager { /** The options for this package manager */ readonly options: PackageManagerOptions; /** Run any command using the package manager */ runAsync(command: string[]): SpawnPromise; /** Get the version of the used package manager */ versionAsync(): Promise; /** Get a single configuration property from the package manager */ getConfigAsync(key: string): Promise; /** Remove the lock file within the project, if any */ removeLockfileAsync(): Promise; /** Get the workspace root package manager, if this project is within a workspace/monorepo */ workspaceRoot(): PackageManager | null; /** Install all current dependencies using the package manager */ installAsync(): Promise | SpawnPromise | PendingSpawnPromise; /** Uninstall all current dependencies by removing the folder containing the packages */ uninstallAsync(): Promise; /** Add a normal dependency to the project */ addAsync(namesOrFlags: string[]): SpawnPromise | PendingSpawnPromise; /** Add a development dependency to the project */ addDevAsync(namesOrFlags: string[]): SpawnPromise | PendingSpawnPromise; /** Add a global dependency to the environment */ addGlobalAsync(namesOrFlags: string[]): SpawnPromise | PendingSpawnPromise; /** Remove a normal dependency from the project */ removeAsync(namesOrFlags: string[]): SpawnPromise | PendingSpawnPromise; /** Remove a development dependency from the project */ removeDevAsync(namesOrFlags: string[]): SpawnPromise | PendingSpawnPromise; /** Remove a global dependency from the environments */ removeGlobalAsync(namesOrFlags: string[]): SpawnPromise | PendingSpawnPromise; }