Skip to content

luftywiranda13/pkg-man

Repository files navigation

pkg-man

Detect which package manager that should be used

Package Version Downloads Status Build Status: Linux Coverage Status

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