which-package-manager
Version:
Detect which package manager is used in the current project
25 lines (16 loc) • 428 B
Markdown
# which-package-manager
Detects the current package manager. Rules applied in order:
- Lock file existence.
- `package.json` structure compatibility.
- `packageManager` field.
- First compatible passed preferred package manager.
## Usage
```sh
npm install which-package-manager
```
```js
import { whichPackageManager } from 'which-package-manager';
const packageManager = await whichPackageManager();
```
## License
MIT