diff --git a/repoconfig.sh b/repoconfig.sh index 231093a2c66..81c33672d95 100644 --- a/repoconfig.sh +++ b/repoconfig.sh @@ -1,6 +1,6 @@ #! /bin/sh # shellcheck disable=SC2034 -NODEJS_VERSION=v16 +NODEJS_VERSION=v20 GOLANG_VERSION=1.20.3 GOLANG_DIR=golang/cosmos GOLANG_DAEMON=$GOLANG_DIR/build/agd @@ -15,3 +15,13 @@ golang_version_check() { echo 1>&2 "need go version 1.20.2+, 1.21+, or 2+" return 1 } + +# Args are major, minor and patch version numbers +nodejs_version_check() { + { + [ "$1" -eq 18 ] && [ "$2" -ge 12 ] && return 0 + [ "$1" -ge 20 ] && [ "$2" -ge 9 ] && return 0 + } 2> /dev/null + echo 1>&2 "need Node.js LTS version ^18.12 or ^20.9, found $1.$2.$3" + return 1 +} diff --git a/scripts/agd-builder.sh b/scripts/agd-builder.sh index 39a1648dc44..9b09c4bfca2 100755 --- a/scripts/agd-builder.sh +++ b/scripts/agd-builder.sh @@ -106,6 +106,12 @@ if $need_nodejs; then } 1>&2 ;; esac + + if nodeversion=$(node --version 2> /dev/null); then + noderegexp='v([0-9]+)\.([0-9]+)\.([0-9]+)' + [[ "$nodeversion" =~ $noderegexp ]] || fatal "illegible node version '$nodeversion'" + nodejs_version_check "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" "${BASH_REMATCH[3]}" || exit 1 + fi fi $do_not_build || ( @@ -194,7 +200,9 @@ $do_not_build || ( test -z "$src" || { echo "At least $src is newer than node_modules" rm -f "$STAMPS/yarn-built" - lazy_yarn install + # Ignore engines since we already checked officially supported versions above + # UNTIL https://github.com/Agoric/agoric-sdk/issues/9622 + lazy_yarn install --ignore-engines } stamp=$STAMPS/yarn-built