diff --git a/build_manager.sh b/build_manager.sh index 0c0feb5..60d7323 100755 --- a/build_manager.sh +++ b/build_manager.sh @@ -2,6 +2,8 @@ set -eu +source ./utils/common.sh + WORKDIR=/home/oscarzhou/source/github.com/portainer GLOBAL_VOLUME=/home/oscarzhou/volumes TRUE=0; @@ -10,10 +12,6 @@ FALSE=1; # PORTAINER_FLAGS= # PORTAINER_FLAGS=--enable-init true -ERROR_COLOR='\033[0;31m'; -HIGHLIGHT_COLOR='\033[0;32m'; -NO_COLOR='\033[0m'; - function choose_repo() { read -p "Choose the working project EE/(CE)/(k8s)/(agent):" REPO @@ -168,13 +166,46 @@ function run_before_commit() { exit; fi - yarn + input "1. Only frontend 2. Only backend 3. Both" option - printf "${HIGHLIGHT_COLOR}yarn format${NO_COLOR}\n" - yarn format + if [ option == "1" ]; then + print_highlight "yarn test"; + yarn test:client - printf "${HIGHLIGHT_COLOR}yarn lint${NO_COLOR}\n" - yarn lint + print_highlight "yarn format"; + yarn format:client + + print_highlight "yarn lint" + yarn lint:client + elif [ option == "2" ]; then + print_highlight "yarn test"; + yarn test:server + + print_highlight "yarn format"; + yarn format:server + + print_highlight "yarn lint" + yarn lint:server + + elif [ option == "3" ]; then + print_highlight "yarn test"; + yarn test + + print_highlight "yarn format"; + yarn format + + print_highlight "yarn lint" + yarn lint + else + print_highlight "yarn test"; + yarn test:client + + print_highlight "yarn format"; + yarn format:client + + print_highlight "yarn lint" + yarn lint:client + fi }