-
-
Save djanowski/eb69d253948bc72da054efe9e3f67542 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
#!/usr/bin/env bash | |
# `nvm use` the version specified in package.json. | |
source $(brew --prefix nvm)/nvm.sh | |
set -eo pipefail | |
die() { | |
echo "$@" >&2 | |
exit 1 | |
} | |
if [[ ! -f package.json ]]; then | |
die "No package.json found." | |
fi | |
NODE_VERSION=$(jq -r .engines.node package.json) | |
if ! nvm use "$NODE_VERSION"; then | |
nvm install "$NODE_VERSION" | |
nvm use "$NODE_VERSION" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment