feat(build): add yarn test into run before commit option

This commit is contained in:
oscar 2022-08-16 21:40:59 +12:00
parent ed0284a7c7
commit 7b66f95832

View File

@ -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"
if [ option == "1" ]; then
print_highlight "yarn test";
yarn test:client
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
printf "${HIGHLIGHT_COLOR}yarn lint${NO_COLOR}\n"
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
}