Commit e5163904 authored by zeke's avatar zeke

handle semver match failures

parent c1f13bf0
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
# fail fast # fail fast
set -e set -e
# Uncomment the line below to enable debugging when # Uncomment the line below to enable debugging
# working on the buildpack
# set -x # set -x
download_and_install_node() { download_and_install_node() {
......
...@@ -30,12 +30,13 @@ if ! test $requested_version; then ...@@ -30,12 +30,13 @@ if ! test $requested_version; then
else else
# Does the already-downloaded stable version of node satisfy the requested version? # Does the already-downloaded stable version of node satisfy the requested version?
default_satisfies=$(node $bp_dir/vendor/semver/bin/semver -v "$stable_version" -r "$requested_version" || echo "") default_satisfies=$($bp_dir/vendor/semver/bin/semver -v "$stable_version" -r "$requested_version" || echo "")
if test $default_satisfies; then if test $default_satisfies; then
status "Latest stable node v$stable_version satisfies engines.node: $requested" status "Latest stable node v$stable_version satisfies engines.node: $requested_version"
node_version=$stable_version node_version=$stable_version
else else
# Fetch all versions of node from nodejs.org/dist and format them into # Fetch all versions of node from nodejs.org/dist and format them into
# a string that the semver binary will appreciate. # a string that the semver binary will appreciate.
# e.g. semver -v "0.10.0" -v "0.10.1" -v "0.10.2" -r ">0.8" # e.g. semver -v "0.10.0" -v "0.10.1" -v "0.10.2" -r ">0.8"
...@@ -45,7 +46,7 @@ else ...@@ -45,7 +46,7 @@ else
args="${args} -r \"${requested_version}\"" args="${args} -r \"${requested_version}\""
# Find all versions that satisfy. # Find all versions that satisfy.
satisfying_versions=$(eval $bp_dir/vendor/semver/bin/semver ${args}) satisfying_versions=$(eval $bp_dir/vendor/semver/bin/semver ${args} || echo "")
# Use the latest one. # Use the latest one.
node_version=$(echo "$satisfying_versions" | tail -n 1) node_version=$(echo "$satisfying_versions" | tail -n 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment