#!/bin/bash

SCRIPT="$1"

if [[ ${PROJECT_PATH:0:1} = "/" ]]; then
    export PROJECT_PATH=$PROJECT_PATH
else
    export PROJECT_PATH="/opt/app/"$PROJECT_PATH
fi

cd $PROJECT_PATH

if [[ $YARN = true ]]; then
    yarn install
else
    npm install
fi

su -c "cd $PROJECT_PATH; $SCRIPT" -s /bin/bash www-app

#!/bin/bash

SCRIPT="$1"

if [[ ${PROJECT_PATH:0:1} = "/" ]]; then
    export PROJECT_PATH=$PROJECT_PATH
else
    export PROJECT_PATH="/opt/app/"$PROJECT_PATH
fi

cd $PROJECT_PATH

if [[ $YARN = true ]]; then
    su -c "cd $PROJECT_PATH; yarn" -s /bin/bash www-app
else
    su -c "cd $PROJECT_PATH; npm i" -s /bin/bash www-app
fi

su -c "cd $PROJECT_PATH; $SCRIPT" -s /bin/bash www-app

Add yarn and npm installed by www-app user
Add yarn and npm installed by www-app user
