Created
June 5, 2023 02:05
-
-
Save cherryramatisdev/96b759a186215d61353b66d49d9fa9ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pushd "$(git rev-parse --show-toplevel)" &>/dev/null | |
get_package_manager() { | |
if [[ -f "yarn.lock" ]]; then | |
echo "yarn" | |
elif [[ -f "package-lock.json" ]]; then | |
echo "npm" | |
elif [[ -f "pnpm-lock.yaml" ]]; then | |
echo "pnpm" | |
else | |
echo "none" | |
fi | |
} | |
package_manager=$(get_package_manager) | |
popd &>/dev/null | |
if [[ "$package_manager" == "none" ]]; then | |
echo "Could not determine package manager" | |
exit 1 | |
fi | |
"$package_manager" "$@" | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment