Detects the current package manager. Rules applied in order:
- Lock file existence.
-
package.json
structure compatibility. -
packageManager
field. - First compatible passed preferred package manager.
npm install which-package-manager
import { whichPackageManager } from 'which-package-manager';
const packageManager = await whichPackageManager();
MIT