UNPKG

2.61 kBTypeScriptView Raw
1/** @module pkg-install */
2import execa from 'execa';
3import { InstallConfig, PackageManagerFlag } from './config';
4import { PackageList, Packages } from './types';
5export declare type InstallResult = execa.ExecaReturns & {
6 ignoredFlags: PackageManagerFlag[];
7};
8/**
9 * Installs a passed set of packages using either npm or yarn. Depending on:
10 * 1) If you specify a preferred package manager
11 * 2) If the program is currently running in an npm or yarn script (using npm run or yarn run)
12 * 3) What package manager is available
13 *
14 * @export
15 * @param {Packages} packages List or object of packages to be installed
16 * @param {Partial<InstallConfig>} [options={}] Options to modify behavior
17 * @returns {Promise<InstallResult>}
18 */
19export declare function install(packages: Packages, options?: Partial<InstallConfig>): Promise<InstallResult>;
20/**
21 * SYNC VERSION. Installs a passed set of packages using either npm or yarn. Depending on:
22 *
23 * 1) If you specify a preferred package manager
24 * 2) If the program is currently running in an npm or yarn script (using npm run or yarn run)
25 * 3) If there is a yarn.lock or package-lock.json available
26 * 4) What package manager is available
27 *
28 * @export
29 * @param {Packages} packages List or object of packages to be installed
30 * @param {Partial<InstallConfig>} [options={}] Options to modify behavior
31 * @returns {InstallResult}
32 */
33export declare function installSync(packages: PackageList, options?: Partial<InstallConfig>): InstallResult;
34/**
35 * Runs `npm install` or `yarn install` for the project. Depending on:
36 *
37 * 1) If you specify a preferred package manager
38 * 2) If the program is currently running in an npm or yarn script (using npm run or yarn run)
39 * 3) If there is a yarn.lock or package-lock.json available
40 * 4) What package manager is available
41 *
42 * @export
43 * @param {Partial<InstallConfig>} [options={}] Options to modify behavior
44 * @returns {Promise<execa.ExecaReturns>}
45 */
46export declare function projectInstall(options?: Partial<InstallConfig>): Promise<execa.ExecaReturns>;
47/**
48 * SYNC VERSION. Runs `npm install` or `yarn install` for the project. Depending on:
49 *
50 * 1) If you specify a preferred package manager
51 * 2) If the program is currently running in an npm or yarn script (using npm run or yarn run)
52 * 3) If there is a yarn.lock or package-lock.json available
53 * 4) What package manager is available
54 *
55 * @export
56 * @param {Partial<InstallConfig>} [options={}] Options to modify behavior
57 * @returns {execa.ExecaReturns}
58 */
59export declare function projectInstallSync(options?: Partial<InstallConfig>): execa.ExecaReturns;