Get the package manager used by a project.
If I should maintain this repo, please ⭐️
DM me on Twitter if you have questions or suggestions.
Installation
npm install which-pkg-manager
yarn add which-pkg-manager
pnpm add which-pkg-manager
bun add which-pkg-manager
Usage
import {
getPackageManagerName,
isNPM,
isYarn,
isPNPM,
isBun
} from "which-pm-lockfile";
const pmName = await getPackageManagerName(); // "npm" | "yarn" | "pnpm" | "bun" | undefined
const npm = await isNPM(); // true | false
const yarn = await isYarn(); // true | false
const pnpm = await isPNPM(); // true | false
const bun = await isBun(); // true | false
Dependencies
- read-json-safe: Read JSON files without try catch
- root-pkg-json: Find the highest package.json, starting from from the current working directory.
- which-pm-lockfile: Check if a project uses yarn, npm, or pnpm
Dev Dependencies
- autorepo: Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts.