Skip to content

Commit

Permalink
Installing Yarn locally
Browse files Browse the repository at this point in the history
  • Loading branch information
paularintaharri committed Apr 17, 2024
1 parent d5bca13 commit 6d37a75
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ selectNodeVersion () {
PATH=/usr/local/bin/node/:$PATH
}

installYarn () {
echo "Installing Yarn locally"
npm install -g yarn@$DESIRED_YARN_VERSION --prefix "$DEPLOYMENT_TARGET/.yarn"
}

##################################################################################################################################
# Deployment
# ----------
Expand All @@ -88,18 +93,15 @@ fi
# 2. Select node version
selectNodeVersion

# 3. Install npm packages
# 3. Install Yarn
DESIRED_YARN_VERSION="1.22.22"
installYarn

# 4. Install npm packages
if [ -e "$DEPLOYMENT_TARGET/package.json" ]; then
cd "$DEPLOYMENT_TARGET"
# Change yarn version
DESIRED_YARN_VERSION="1.22.22"
CURRENT_YARN_VERSION=$(yarn --version)
if [[ "$CURRENT_YARN_VERSION" != "$DESIRED_YARN_VERSION" ]]; then
echo "Vaihdetaan Yarn-versioon $DESIRED_YARN_VERSION"
npm install -g yarn@$DESIRED_YARN_VERSION
fi
echo "Running yarn install"
yarn install
"$DEPLOYMENT_TARGET/.yarn/bin/yarn" install
exitWithMessageOnError "yarn failed"
cd - > /dev/null
fi
Expand Down

0 comments on commit 6d37a75

Please sign in to comment.