2.0.0 • Published 3 years ago
@mheob/check-package-manager v2.0.0
Check for correct package manager
A simple check of the usage of the correct package manager.
Install
The local installation is optional. It is only needed if you want to have the package inside your project. This could improve performance, for example.
With NPM
npm install -D @mheob/check-package-managerWith YARN
yarn add -D @mheob/check-package-managerWith PNPM
pnpm add -D @mheob/check-package-managerUsage
As script in package.json
Use one of the examples.
"scripts": {
"check-package-manager": "npx @mheob/check-package-manager npm", // NPM
"check-package-manager": "yarn dlx @mheob/check-package-manager yarn", // YARN
"check-package-manager": "yarn exec @mheob/check-package-manager yarn", // YARN - locally installed
"check-package-manager": "pnpm dlx @mheob/check-package-manager", // PNPM
"check-package-manager": "pnpm dlx @mheob/check-package-manager pnpm", // PNPM - alternative
"check-package-manager": "pnpm exec @mheob/check-package-manager", // PNPM - locally installed
"check-package-manager": "pnpm exec @mheob/check-package-manager pnpm", // PNPM - alternative locally installed
},As shell script
Default (same as PNPM)
Use npx if you use NPM as package manager.\
Otherwise use exec if you have installed the package in your project, otherwise use dlx.
npx @mheob/check-package-managerNPM
npx @mheob/check-package-manager npmYARN
yarn dlx @mheob/check-package-manager yarnPNPM
pnpm dlx @mheob/check-package-manager pnpmAs git hook
For example used in combination with husky.
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
[ -n "$CI" ] && exit 0
pnpm dlx @mheob/check-package-manager