pkg-install
- Version 1.0.0
- Published
- 83.3 kB
- 3 dependencies
- MIT license
Install
npm i pkg-install
yarn add pkg-install
pnpm add pkg-install
Overview
A wrapper making installation of Node.js packages from code easier
Index
Functions
function getPackageManager
getPackageManager: (config: InstallConfig) => Promise<SupportedPackageManagers>;
Determine what package manager to use based on what preference is set, and whether it's currently running in a yarn/npm script
Parameter config
Returns
{Promise}
function getPackageManagerSync
getPackageManagerSync: (config: InstallConfig) => SupportedPackageManagers;
SYNC: Determine what package manager to use based on what preference is set, and whether it's currently running in a yarn/npm script
Parameter config
Returns
{SupportedPackageManagers}
function install
install: ( packages: Packages, options?: Partial<InstallConfig>) => Promise<InstallResult>;
Installs a passed set of packages using either npm or yarn. Depending on: 1) If you specify a preferred package manager 2) If the program is currently running in an npm or yarn script (using npm run or yarn run) 3) What package manager is available
Parameter packages
List or object of packages to be installed
Parameter options
Options to modify behavior
Returns
{Promise}
function installSync
installSync: ( packages: PackageList, options?: Partial<InstallConfig>) => InstallResult;
SYNC VERSION. Installs a passed set of packages using either npm or yarn. Depending on:
1) If you specify a preferred package manager 2) If the program is currently running in an npm or yarn script (using npm run or yarn run) 3) If there is a yarn.lock or package-lock.json available 4) What package manager is available
Parameter packages
List or object of packages to be installed
Parameter options
Options to modify behavior
Returns
{InstallResult}
function projectInstall
projectInstall: ( options?: Partial<InstallConfig>) => Promise<execa.ExecaReturns>;
Runs
npm install
oryarn install
for the project. Depending on:1) If you specify a preferred package manager 2) If the program is currently running in an npm or yarn script (using npm run or yarn run) 3) If there is a yarn.lock or package-lock.json available 4) What package manager is available
Parameter options
Options to modify behavior
Returns
{Promise<execa.ExecaReturns>}
function projectInstallSync
projectInstallSync: (options?: Partial<InstallConfig>) => execa.ExecaReturns;
SYNC VERSION. Runs
npm install
oryarn install
for the project. Depending on:1) If you specify a preferred package manager 2) If the program is currently running in an npm or yarn script (using npm run or yarn run) 3) If there is a yarn.lock or package-lock.json available 4) What package manager is available
Parameter options
Options to modify behavior
Returns
{execa.ExecaReturns}
Type Aliases
type ConstructArgumentsResult
type ConstructArgumentsResult = { args: string[]; ignoredFlags: PackageManagerFlag[];};
type InstallResult
type InstallResult = execa.ExecaReturns & { ignoredFlags: PackageManagerFlag[];};
type PackageList
type PackageList = string[];
type PackageMap
type PackageMap = { [packageName: string]: string | undefined;};
pkg-install
type Packages
type Packages = PackageMap | PackageList;
type StdioOption
type StdioOption = 'pipe' | 'ignore' | 'inherit';
What to do with I/O. This is passed to
execa
type SupportedPackageManagers
type SupportedPackageManagers = 'yarn' | 'npm';
Package Files (4)
Dependencies (3)
Dev Dependencies (11)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/pkg-install
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/pkg-install)
- HTML<a href="https://www.jsdocs.io/package/pkg-install"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 1040 ms. - Missing or incorrect documentation? Open an issue for this package.