Skip to content

Instantly share code, notes, and snippets.

@victory-sokolov
Created November 16, 2025 08:06
Show Gist options
  • Select an option

  • Save victory-sokolov/7614112e2be66b85ba19ceefe17ebd67 to your computer and use it in GitHub Desktop.

Select an option

Save victory-sokolov/7614112e2be66b85ba19ceefe17ebd67 to your computer and use it in GitHub Desktop.
Get Node Package manager that project is using
get_node_package_manager() # Get Node package manager
{
if [[ -f bun.lockb ]]; then
echo "bun"
elif [[ -f pnpm-lock.yaml ]]; then
echo "pnpm"
elif [[ -f yarn.lock ]]; then
echo "yarn"
elif [[ -f package-lock.json ]]; then
echo "npm"
else
echo "Package manager not found"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment