From 7b66f95832fdaf1d6341930d18cebc5691a43718 Mon Sep 17 00:00:00 2001 From: oscar Date: Tue, 16 Aug 2022 21:40:59 +1200 Subject: [PATCH] feat(build): add yarn test into run before commit option --- build_manager.sh | 49 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 9 deletions(-) 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 }