A simple check of the usage of the correct package manager.
No installation is needed. Just run with npx
.
Use one of the examples.
"scripts": {
"use-correct-pm": "npx use-correct-pm", // PNPM
"use-correct-pm": "npx use-correct-pm pnpm", // PNPM
"use-correct-pm": "npx use-correct-pm npm", // NPM
"use-correct-pm": "npx use-correct-pm yarn", // YARN
"use-correct-pm": "npx use-correct-pm bun", // BUN
},
Use npx
if you use NPM
as package manager.
For PNPM
and YARN
use exec
if you have installed the package in your project, otherwise use dlx
.
If you use BUN
as your package manager use bunx
.
npx use-correct-pm
# or
npx use-correct-pm pnpm
npx use-correct-pm npm
npx use-correct-pm yarn
npx use-correct-pm bun
For example used in combination with husky.
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
[ -n "$CI" ] && exit 0
npx use-correct-pm