2.0.0 • Published 6 years ago

pkg-man v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

pkg-man

Package Version Build Status: Linux Coverage Status Downloads Status

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

License

MIT © Lufty Wiranda