UNPKG

1.64 kBTypeScriptView Raw
1/// <reference types="node" />
2import { ExecOptions, ExecSyncOptions, SpawnOptions } from 'child_process';
3import { PackageManagers } from './api';
4/**
5 * Provides an async check for if we are equipped to use `yarn` for package management operations.
6 * @internal
7 */
8export declare const shouldUseYarn: () => Promise<boolean>;
9/**
10 * Provides an async check for if we are equipped to use `npm` in the current root as fallback for package management
11 * operations.
12 *
13 * @see {@link https://bit.ly/2rEVJtD}.
14 * @ignore
15 */
16export declare const canUseNpm: (root: string) => Promise<boolean>;
17/**
18 * Abstraction around the logic to manage node package-manager related tasks such as installing, removing packages, etc.
19 */
20export declare class PackageManager {
21 readonly binary: PackageManagers;
22 constructor(binary: PackageManagers);
23 get commands(): {
24 [key: string]: string;
25 };
26 /**
27 * Adds a new dependency to a project.
28 */
29 addDependency(packages: string, options?: SpawnOptions): Promise<unknown>;
30 /**
31 * Installs all the dependencies listed in package.json.
32 */
33 installAllDependencies(options?: ExecOptions): Promise<unknown>;
34 /**
35 * Executes a custom command with the current package manager.
36 */
37 exec(args: string[], options?: SpawnOptions): Promise<unknown>;
38 execBinary(command: string, options?: ExecSyncOptions): void;
39}
40/**
41 * Returns a cached package manager instance with the binary set according depending on the availability of npm/yarn.
42 */
43export declare const getPackageManager: () => Promise<PackageManager>;
44//# sourceMappingURL=package-manager.d.ts.map
\No newline at end of file