Commit 94b09823 authored by 吴军's avatar 吴军

Merge branch 'feature/zxs-VueCodeCheck-20211108' into 'master'

优化检测脚本

See merge request !48
parents ec4a976d bbb4467d
...@@ -40,9 +40,9 @@ function push_check_status() { ...@@ -40,9 +40,9 @@ function push_check_status() {
count=`git diff --name-status $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA | grep -E '.js$|.vue$' | egrep -v '^D' | awk '{print $2}'` count=`git diff --name-status $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA | grep -E '.js$|.vue$' | egrep -v '^D' | awk '{print $2}'`
if [[ -n "$count" ]]; then if [[ -n "$count" ]]; then
npm install @vue/babel-preset-app --registry https://hub.zmcms.cn/repository/npm-group/ # npm install @vue/babel-preset-app --registry https://hub.zmcms.cn/repository/npm-group/
echo -e "\n${PURPLE}================== 开始检测JS文件==================${COLOR_END}" echo -e "\n${PURPLE}================== 开始检测JS文件==================${COLOR_END}"
for file in $count; do # for file in $count; do
# 文件状态 # 文件状态
# D: deleted # D: deleted
# A: added # A: added
...@@ -52,14 +52,15 @@ if [[ -n "$count" ]]; then ...@@ -52,14 +52,15 @@ if [[ -n "$count" ]]; then
# 文件名 # 文件名
#file=$(echo $line | sed 's/^.//') #file=$(echo $line | sed 's/^.//')
# echo $file # echo $file
echo -e "\n$file" # echo -e "\n$file"
vue-cli-service lint --fix $file &>> check_result.txt echo -e "\n$count"
npm run lint $file &>> check_result.txt
output=$? output=$?
if [ $output != 0 ]; then if [ $output != 0 ]; then
let "errors_count = errors_count + 1" let "errors_count = errors_count + 1"
fi fi
done # done
fi fi
if [[ $errors_count > 0 ]]; then if [[ $errors_count > 0 ]]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment