Skip to content

Instantly share code, notes, and snippets.

@jbouhier
Created November 22, 2023 17:08
Show Gist options
  • Save jbouhier/d119647ee3dda0be6a54f9cb56e71bfb to your computer and use it in GitHub Desktop.
Save jbouhier/d119647ee3dda0be6a54f9cb56e71bfb to your computer and use it in GitHub Desktop.
JS pacakge manager CLI shorthand
# Automatically uses the package manager of current directory
# Just type "start" or any other scripts fo your package.json file
p() {
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 pnpm "$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment