1import { SpawnOptions, SpawnPromise, SpawnResult } from '@expo/spawn-async';
2import { PendingSpawnPromise } from './utils/spawn';
3export interface PackageManagerOptions extends SpawnOptions {
4    /**
5     * If the package manager should run in silent mode.
6     * Note, this will hide possible error output from executed commands.
7     * When running in silent mode, make sure you handle them properly.
8     */
9    silent?: boolean;
10    /**
11     * The logging method used to communicate the command which is executed.
12     * Without `silent`, this defaults to `console.log`.
13     * When `silent` is set to `true`, this defaults to a no-op.
14     */
15    log?: (...args: any[]) => void;
16}
17export interface PackageManager {
18    /** The options for this package manager */
19    readonly options: PackageManagerOptions;
20    /** Run any command using the package manager */
21    runAsync(command: string[]): SpawnPromise<SpawnResult>;
22    /** Get the version of the used package manager */
23    versionAsync(): Promise<string>;
24    /** Get a single configuration property from the package manager */
25    getConfigAsync(key: string): Promise<string>;
26    /** Remove the lock file within the project, if any */
27    removeLockfileAsync(): Promise<void>;
28    /** Get the workspace root package manager, if this project is within a workspace/monorepo */
29    workspaceRoot(): PackageManager | null;
30    /** Install all current dependencies using the package manager */
31    installAsync(): Promise<SpawnResult> | SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
32    /** Uninstall all current dependencies by removing the folder containing the packages */
33    uninstallAsync(): Promise<void>;
34    /** Add a normal dependency to the project */
35    addAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
36    /** Add a development dependency to the project */
37    addDevAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
38    /** Add a global dependency to the environment */
39    addGlobalAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
40    /** Remove a normal dependency from the project */
41    removeAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
42    /** Remove a development dependency from the project */
43    removeDevAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
44    /** Remove a global dependency from the environments */
45    removeGlobalAsync(namesOrFlags: string[]): SpawnPromise<SpawnResult> | PendingSpawnPromise<SpawnResult>;
46}
47