can-pnpm
v0.4.0
Published
Check if pnpm is used instead of npm
Downloads
34
Maintainers
Readme
can-pnpm
can-pnpm
is a npm package that detects the presence of pnpm in your project or system. If pnpm is not found, it provides information about other detected package managers.
Install
pnpm install can-pnpm
# or
npm install can-pnpm
# or
yarn add can-pnpm
Usage
import canPnpm from 'can-pnpm';
const result = await canPnpm();
console.log(result);
If pnpm is detected:
{
canPnpm: true,
reason: 'local lock file' | 'global installation'
}
If pnpm is not detected:
{
canPnpm: false,
otherManagers: [
{
name: 'yarn' | 'npm' | 'bun',
detected: 'local lock file' | 'global installation'
},
// ... (other detected package managers)
]
}
How it works
- The package first checks for a
pnpm-lock.yaml
file in the specified directory (or current working directory if not specified). - If the lock file is not found, it checks for a global pnpm installation.
- If
pnpm
is not detected, it checks for the presence of other package managers (yarn, npm, and bun) by looking for their respective lock files and global installations.
Changelog
KEY: 📦 NEW
, 👌 IMPROVE
, 🐛 FIX
, 📖 DOC
, 🚀 RELEASE
, and 🤖 TEST
I use Emoji-log, you should try it and simplify your git commits.
License & Conduct
Connect
Sponsor
Me (Ahmad Awais) and my incredible wife (Maedah Batool) are two engineers who fell in love with open source and then with each other. You can read more about me here. If you or your company use any of my projects or like what I’m doing then consider backing me. I'm in this for the long run. An open-source developer advocate.
NodeCLI.com — Learn to build Node.js CLI Automation
This repository is part of the NodeCLI.com course.
After building hundreds of developer automation tools used by millions of developers, I am sharing exactly how you can do it yourself with minimum effective effort. Learn to build Node.js & JavaScript based CLI (Command Line Interface) apps. Automate the grunt work, do more in less time, impress your manager, and help the community. → I'm sharing it all in this online video course. Node CLI Automation without wasting a 1,000 hours →