# what-pm

> Detects what package manager was used for installation

Latest version **3.3.1** (published 2024-11-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install what-pm
pnpm add what-pm
yarn add what-pm
bun add what-pm
```

Provides the commands `whatpm`, `what-pm`.

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.3.1 |
| Published | 2024-11-26 |
| First published | 2023-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 13.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | saqqdy |
| Maintainers | saqqdy |
| Keywords | node-kit, packageManager, which-pm, what-pm |

## Links

- npm: https://www.npmjs.com/package/what-pm
- Repository: https://github.com/saqqdy/node-kit
- Homepage: https://github.com/saqqdy/node-kit/tree/master/packages/what-pm#readme
- Issues: https://github.com/saqqdy/node-kit/issues
- npm.io page: https://npm.io/package/what-pm

## Dependencies (4)

- [find-up](https://npm.io/package/find-up.md) ^5.0.0
- [pm-info](https://npm.io/package/pm-info.md) 3.3.1
- [workspace-root](https://npm.io/package/workspace-root.md) 3.3.1
- [@pkgjs/parseargs](https://npm.io/package/@pkgjs/parseargs.md) ^0.11.0

## Recent versions

- 3.3.1 (latest) — 2024-11-26
- 3.0.0-beta.5 (beta) — 2023-07-02
- 1.0.0-alpha.8 (alpha) — 2023-01-17
- 3.3.0 — 2024-11-21
- 3.2.0 — 2023-08-28
- 3.1.1 — 2023-07-10
- 3.1.0 — 2023-07-05
- 3.0.0 — 2023-07-02
- 3.0.0-beta.4 — 2023-07-02
- 3.0.0-beta.3 — 2023-07-01
- 3.0.0-beta.2 — 2023-07-01
- 2.5.1 — 2023-04-24
- 2.5.0 — 2023-04-22
- 2.4.0 — 2023-04-20
- 2.3.0 — 2023-03-01
- … 11 more at https://npm.io/package/what-pm/versions

## README

<div style="text-align: center;" align="center">

# what-pm

Detects what package manager was used for installation

[![NPM version][npm-image]][npm-url]
[![Codacy Badge][codacy-image]][codacy-url]
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]
[![License][license-image]][license-url]

[![Sonar][sonar-image]][sonar-url]

</div>

## Install

```bash
# use pnpm
$ pnpm install what-pm

# use yarn
$ yarn add what-pm

# use npm
$ npm install what-pm
```

## Usage

use `what-pm` in terminal

```bash
npx what-pm
# or
npx whatpm

# output: pnpm
```

use import

```js
import { whatPM, whatPMSync } from 'what-pm'

whatPM()
// or
whatPMSync()
```

use require

```js
const { whatPM, whatPMSync } = require('what-pm')

whatPM()
// or
whatPMSync()
```

## API reference

- Usage: `whatPM(pkgPath)` & `whatPMSync(pkgPath)`
- Parameters:

<div class="table-prop">

| Param   | Description  | Type     | Optional value | Required | Default value |
| ------- | ------------ | -------- | -------------- | -------- | ------------- |
| pkgPath | package path | `string` | -              | `true`   | -             |

</div>

- Types:

```ts
declare function whatPM(pkgPath: string): Promise<WhatPMResult | null>

declare interface WhatPMResult {
  name: string
  version: string
  isWorkspace: boolean
}

declare function whatPMSync(pkgPath: string): WhatPMResult | null
```

- Demos:

1. simple use

```ts
import { whatPM, whatPMSync } from 'what-pm'

whatPM().then(info => {
  console.log('The package manager is: ', info) // pnpm | null
})

console.log('The package manager is: ', whatPMSync()) // pnpm | null
```

## Issues & Support

Please open an issue [here](https://github.com/saqqdy/node-kit/issues).

## License

[MIT](LICENSE)

[npm-image]: https://img.shields.io/npm/v/what-pm.svg?style=flat-square
[npm-url]: https://npmjs.org/package/what-pm
[codacy-image]: https://app.codacy.com/project/badge/Grade/f70d4880e4ad4f40aa970eb9ee9d0696
[codacy-url]: https://www.codacy.com/gh/saqqdy/what-pm/dashboard?utm_source=github.com&utm_medium=referral&utm_content=saqqdy/what-pm&utm_campaign=Badge_Grade
[codecov-image]: https://img.shields.io/codecov/c/github/saqqdy/what-pm.svg?style=flat-square
[codecov-url]: https://codecov.io/github/saqqdy/what-pm?branch=master
[download-image]: https://img.shields.io/npm/dm/what-pm.svg?style=flat-square
[download-url]: https://npmjs.org/package/what-pm
[license-image]: https://img.shields.io/badge/License-MIT-blue.svg
[license-url]: LICENSE
[sonar-image]: https://sonarcloud.io/api/project_badges/quality_gate?project=saqqdy_node-kit
[sonar-url]: https://sonarcloud.io/dashboard?id=saqqdy_node-kit

---
_Source: https://npm.io/package/what-pm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
