pkg-man
v2.0.0
Published
Detect which package manager that should be used
Downloads
3
Maintainers
Readme
pkg-man
Detect which package manager that should be used
Installation
npm install --save pkg-man
Usage
$ tree
├── bar
│ ├── package.json
│ └── yarn.lock
├── baz
│ ├── package-lock.json
│ ├── package.json
│ └── yarn.lock
├── foo
│ ├── package-lock.json
│ └── package.json
└── package.json
const pkgMan = require('pkg-man');
pkgMan({ cwd: 'bar' });
//=> yarn
pkgMan({ cwd: 'baz' });
//=> npm
pkgMan({ cwd: 'foo' });
//=> npm
pkgMan();
//=> npm
pkgMan({ preferred: 'yarn' });
//=> yarn
pkgMan({ cwd: 'baz', preferred: 'yarn' });
//=> yarn
API
pkgMan([options])
options
Type: Object
cwd
Type: string
Default: process.cwd()
Current working directory.
preferred
Type: string
Default: npm
Preferred package manager if no lockfile or multiple lockfiles found.
Related
- pkg-man-cli - CLI for this module
- has-lockfile - Detect lockfiles in the working directory
License
MIT © Lufty Wiranda