Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luftywiranda13/pkg-man
Detect which package manager that should be used
https://github.com/luftywiranda13/pkg-man
check dependencies detect nodejs npm yarn
Last synced: about 2 months ago
JSON representation
Detect which package manager that should be used
- Host: GitHub
- URL: https://github.com/luftywiranda13/pkg-man
- Owner: luftywiranda13
- License: mit
- Created: 2017-09-15T16:53:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-03T09:18:45.000Z (over 4 years ago)
- Last Synced: 2024-11-13T18:15:46.917Z (about 2 months ago)
- Topics: check, dependencies, detect, nodejs, npm, yarn
- Language: JavaScript
- Size: 147 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# pkg-man
> Detect which package manager that should be used
[![Package Version](https://img.shields.io/npm/v/pkg-man.svg?style=flat-square)](https://www.npmjs.com/package/pkg-man)
[![Downloads Status](https://img.shields.io/npm/dm/pkg-man.svg?style=flat-square)](https://npm-stat.com/charts.html?package=pkg-man&from=2016-04-01)
[![Build Status: Linux](https://img.shields.io/travis/luftywiranda13/pkg-man/master.svg?style=flat-square)](https://travis-ci.org/luftywiranda13/pkg-man)
[![Coverage Status](https://img.shields.io/codecov/c/github/luftywiranda13/pkg-man/master.svg?style=flat-square)](https://codecov.io/gh/luftywiranda13/pkg-man)## Installation
```sh
npm install --save pkg-man
```## Usage
```sh
$ tree
├── bar
│ ├── package.json
│ └── yarn.lock
├── baz
│ ├── package-lock.json
│ ├── package.json
│ └── yarn.lock
├── foo
│ ├── package-lock.json
│ └── package.json
└── package.json
``````js
const pkgMan = require('pkg-man');pkgMan({ cwd: 'bar' });
//=> yarnpkgMan({ cwd: 'baz' });
//=> npmpkgMan({ cwd: 'foo' });
//=> npmpkgMan();
//=> npmpkgMan({ preferred: 'yarn' });
//=> yarnpkgMan({ 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](https://github.com/luftywiranda13/pkg-man-cli) - CLI for this module
* [has-lockfile](https://github.com/luftywiranda13/has-lockfile) - Detect lockfiles in the working directory## License
MIT © [Lufty Wiranda](https://www.luftywiranda.com)