Returns the preferred package manager of a project
package-lock.json is present, npm is preferred.yarn.lock is present, Yarn is preferred.pnpm-lock.yaml is present, pnpm is preferred.bun.lockb is present, Bun is preferred.node_modules is present, tries to detect which package manager installed it.<pnpm|yarn|npm|bun> add preferred-pm
'use strict'
const preferredPM = require('preferred-pm')
preferredPM(process.cwd())
.then(pm => console.log(pm))
//> {name: "npm", version: ">=5"}
MIT © Zoltan Kochan