Skip to content

Commit

Permalink
build-all.sh: Fix issue with older builds
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandesu committed Jan 18, 2024
1 parent 722b514 commit 27bb040
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions build/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ git stash push -u -m before-build-all

# Save current Node version to reset after building all the versions
FNM_VERSION="$(fnm current)"
FNM_DEFAULT=$(fnm list | grep default | tr "*" " " | tr "default" " " | xargs)

# shellcheck disable=SC2317
function cleanup {
Expand All @@ -53,6 +54,9 @@ function cleanup {
if [ "$FNM_VERSION" != "" ] && [ "$FNM_VERSION" != "none" ]; then
fnm use "$FNM_VERSION"
fi
if [ "$FNM_DEFAULT" != "" ] && [ "$FNM_DEFAULT" != "none" ]; then
fnm default "$FNM_DEFAULT"
fi

# Restore previous node_modules
rm -r ./node_modules
Expand Down Expand Up @@ -90,10 +94,13 @@ do
# Switch Node.js version on certain tags
if beginswith "0." "$TAG" || beginswith "1.0." "$TAG" || beginswith "1.1." "$TAG" || beginswith "1.2." "$TAG" || beginswith "1.3." "$TAG"; then
fnm use --install-if-missing 10
fnm default 10
elif beginswith "1.4." "$TAG" || beginswith "1.5." "$TAG" || beginswith "1.6." "$TAG" || beginswith "1.7." "$TAG"; then
fnm use --install-if-missing 14
fnm default 14
else
fnm use --install-if-missing 20
fnm default 20
fi
# Install dependencies
npm ci
Expand Down

0 comments on commit 27bb040

Please sign in to comment.