From 6d37a75cedb5385c30d3fb9f9dd190669967fedb Mon Sep 17 00:00:00 2001 From: Paula Rinta-Harri Date: Wed, 17 Apr 2024 12:55:52 +0300 Subject: [PATCH] Installing Yarn locally --- deploy.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/deploy.sh b/deploy.sh index 678a2a1..615727c 100644 --- a/deploy.sh +++ b/deploy.sh @@ -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 # ---------- @@ -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