Skip to content

Instantly share code, notes, and snippets.

@nahtnam
Created August 4, 2024 01:11
Show Gist options
  • Save nahtnam/55ab02f1ca2f15e46a9ea772ddb7e5ce to your computer and use it in GitHub Desktop.
Save nahtnam/55ab02f1ca2f15e46a9ea772ddb7e5ce to your computer and use it in GitHub Desktop.
nodePackageManager() {
if [[ -f bun.lockb ]]; then
command bun "$@"
elif [[ -f pnpm-lock.yaml ]]; then
command pnpm "$@"
elif [[ -f yarn.lock ]]; then
command yarn "$@"
elif [[ -f package-lock.json ]]; then
command npm "$@"
else
command npm "$@"
fi
}
alias npm=nodePackageManager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment