Skip to content

Commit f2f2cdc

Browse files
committed
🎨 issue列表展示msg信息
🔧 调整构建部署配置 🔧 调整doc配置 🍱 web 打包构建资源
1 parent 8a17892 commit f2f2cdc

8 files changed

Lines changed: 814 additions & 566 deletions

File tree

doc/.vuepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineUserConfig } from '@vuepress/cli'
22
import { defaultTheme } from '@vuepress/theme-default'
3+
import { searchPlugin } from '@vuepress/plugin-search'
34
import { navbar, sidebar } from './configs'
4-
const { searchPlugin } = require('@vuepress/plugin-search')
55

66
const isProd = process.env.NODE_ENV === 'production'
77

doc/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
"tca",
77
"document"
88
],
9+
"type": "module",
910
"license": "MIT",
1011
"scripts": {
1112
"dev": "vuepress dev",
1213
"build:comment": "echo '构建帮助文档,默认base前缀为document,可根据部署需要进行相应调整'",
1314
"build": "BASE=${BASE:-CodeAnalysis} vuepress build -d ./dist"
1415
},
1516
"devDependencies": {
16-
"@vuepress/plugin-search": "^2.0.0-beta.43",
17-
"vuepress": "^2.0.0-beta.42"
17+
"@vuepress/plugin-search": "2.0.0-beta.51",
18+
"vuepress": "2.0.0-beta.51"
1819
}
19-
}
20+
}

doc/yarn.lock

Lines changed: 754 additions & 530 deletions
Large diffs are not rendered by default.

web/build-source.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22

33
# 用于管道命令 只要一个子命令失败,整个管道命令就失败,脚本就会终止执行
44
set -eo pipefail
@@ -13,9 +13,19 @@ function warning() {
1313
echo -e "\033[33m >>> $*\033[0;39m"
1414
}
1515

16+
# 当前脚本执行目录
17+
CURRENT_PATH=$(
18+
cd "$(dirname "${BASH_SOURCE[0]}")"
19+
pwd
20+
)
21+
22+
# web目录
23+
ROOT_PATH=$CURRENT_PATH
24+
25+
cd "$ROOT_PATH"
26+
1627
# git 版本
1728
GIT_REVISION=$(git rev-parse HEAD)
18-
ROOT_PATH=$(pwd)
1929
CONF_PATH="${ROOT_PATH}/tca-deploy-source/conf/"
2030
BUILD_ZIP_PATH="${ROOT_PATH}/tca-deploy-source/build_zip/"
2131

-241 KB
Binary file not shown.
3.37 KB
Binary file not shown.

web/tca-deploy-source/conf/configs.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@
4040
"prefix": [
4141
"/static/tca-analysis/"
4242
],
43-
"commitId": "aea7b3a3759f985ad24abc12d44060fd09802fcf",
43+
"commitId": "8a178929623697853fbc145fa1e75d23c74374f9",
4444
"match": "^/t/[^/]+/p/[^/]+/(code-analysis|repos|template|profile|group)",
4545
"js": [
46-
"/static/tca-analysis/runtime~tca-analysis-e16cd21c.js",
47-
"/static/tca-analysis/vendors~tca-analysis-fadc07ae.js",
48-
"/static/tca-analysis/tca-analysis-2d4f5465.js"
46+
"/static/tca-analysis/runtime~tca-analysis-c9a232b2.js",
47+
"/static/tca-analysis/vendors~tca-analysis-c2cc8806.js",
48+
"/static/tca-analysis/tca-analysis-54f1ce10.js"
4949
],
5050
"css": [
51-
"/static/tca-analysis/tca-analysis-4d2e233a.css"
51+
"/static/tca-analysis/tca-analysis-b26cebab.css"
5252
]
5353
},
5454
{

web/tca-deploy-source/scripts/init.sh

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22

33
# Customizable environment variables:
44
# +---------------------+----------------------+----------------------------------------------+
@@ -19,20 +19,33 @@
1919
### 方式二:查阅上述环境变量,先export对应环境变量,再 bash init.sh
2020
###########################
2121

22+
set -eo pipefail
23+
24+
# 当前脚本执行目录
25+
CURRENT_PATH=$(
26+
cd "$(dirname "${BASH_SOURCE[0]}")"
27+
pwd
28+
)
29+
2230
# 获取工作目录路径,绝对路径
23-
WORK_PATH=$(cd $(dirname $0) && pwd)
31+
WORK_PATH=$CURRENT_PATH
32+
2433
# 获取上层目录,即tca-deploy-source根目录
25-
ROOT_PATH=$(cd $(dirname $0) && cd ../ && pwd)
34+
ROOT_PATH=$(dirname "${WORK_PATH}")
35+
36+
cd "$ROOT_PATH"
2637

27-
source $WORK_PATH/_log.sh
38+
# shellcheck disable=SC1091
39+
source "$WORK_PATH"/_log.sh
2840

2941
# 默认使用config.sh内的环境变量配置
30-
if [ "$1" == "default" -o "$1" == "-d" ]; then
31-
source $WORK_PATH/config.sh
42+
if [ "$1" == "default" ] || [ "$1" == "-d" ]; then
43+
# shellcheck disable=SC1091
44+
source "$WORK_PATH"/config.sh
3245
fi
3346

3447
# 校验必传项
35-
if [ ! -n "$SERVER_ENV" ]; then
48+
if [ -z "$SERVER_ENV" ]; then
3649
LOG_WARN "SERVER_ENV: 请指定前端访问后端的服务地址"
3750
exit 1
3851
fi
@@ -73,33 +86,33 @@ function clear_old_nginx_conf() {
7386
# 清除各个应用的nginx conf文件
7487
MICRO_FRONTEND="$MICRO_FRONTEND_FRAMEWORK $MICRO_FRONTEND_APPS $MICRO_FRONTEND_DOCUMENT"
7588
for app in $MICRO_FRONTEND; do
76-
rm -f $NGINX_CONF_PATH/$app.conf
89+
rm -f "$NGINX_CONF_PATH"/"$app".conf
7790
done
7891
}
7992

8093
# 清理资源文件
8194
function clear_assets() {
8295
LOG_WARN "将路径下的资源文件和前端nginx配置备份到 ${WEB_DEPLOY_PATH}_bak 下..."
83-
cp -r $WEB_DEPLOY_PATH/ ${WEB_DEPLOY_PATH}_bak/
84-
cp -r $NGINX_CONF_PATH/tca_ingress.conf ${WEB_DEPLOY_PATH}_bak/
96+
cp -r "$WEB_DEPLOY_PATH"/ "${WEB_DEPLOY_PATH}"_bak/
97+
cp -r "$NGINX_CONF_PATH"/tca_ingress.conf "${WEB_DEPLOY_PATH}"_bak/
8598
LOG_INFO "开始清理路径下的资源文件 $WEB_DEPLOY_PATH ..."
86-
rm -rf $WEB_DEPLOY_PATH/
99+
rm -rf "${WEB_DEPLOY_PATH:?}"/
87100
LOG_INFO "开始清理前端nginx配置 ..."
88-
rm -f $NGINX_CONF_PATH/tca_ingress.conf
101+
rm -f "$NGINX_CONF_PATH"/tca_ingress.conf
89102
}
90103

91104
# 解压编译后文件
92105
function init_unzip_build() {
93106
LOG_INFO "解压编译后文件到 $WEB_DEPLOY_PATH ..."
94-
rm -rf $WEB_DEPLOY_PATH/
95-
mkdir -p $WEB_DEPLOY_PATH
96-
cd $ROOT_PATH/build_zip/
107+
rm -rf "${WEB_DEPLOY_PATH:?}"/
108+
mkdir -p "$WEB_DEPLOY_PATH"
109+
cd "$ROOT_PATH"/build_zip/
97110
# 遍历并解压
98111
MICRO_FRONTEND="$MICRO_FRONTEND_FRAMEWORK $MICRO_FRONTEND_APPS $MICRO_FRONTEND_DOCUMENT"
99112
for app in $MICRO_FRONTEND; do
100-
unzip -q -o $app.zip -d $WEB_DEPLOY_PATH/$app
113+
unzip -q -o "$app".zip -d "$WEB_DEPLOY_PATH"/"$app"
101114
done
102-
cd $ROOT_PATH
115+
cd "$ROOT_PATH"
103116
}
104117

105118
# 初始化配置 framework
@@ -123,8 +136,8 @@ function init_framework_web() {
123136
"
124137
LOG_INFO "[INFO]:index.html RUNTIME is enabled"
125138
LOG_INFO "[INFO]: change 404.html, unsupported-browser.html"
126-
sed -i "$replace_content" $FRAMEWORK_DEPLOY_PATH/404.html
127-
sed -i "$replace_content" $FRAMEWORK_DEPLOY_PATH/unsupported-browser.html
139+
sed -i "$replace_content" "$FRAMEWORK_DEPLOY_PATH"/404.html
140+
sed -i "$replace_content" "$FRAMEWORK_DEPLOY_PATH"/unsupported-browser.html
128141

129142
LOG_INFO "[INFO]: change index.html"
130143
sed \
@@ -133,12 +146,12 @@ function init_framework_web() {
133146
s|__MICRO_FRONTEND_API__|$MICRO_FRONTEND_API|g; \
134147
s|__MICRO_FRONTEND_SETTING_API__|$MICRO_FRONTEND_SETTING_API|g; \
135148
" \
136-
$FRAMEWORK_DEPLOY_PATH/index.runtime.html >$FRAMEWORK_DEPLOY_PATH/index.html
149+
"$FRAMEWORK_DEPLOY_PATH"/index.runtime.html >"$FRAMEWORK_DEPLOY_PATH"/index.html
137150

138151
LOG_INFO "conf 配置迁移 ..."
139152
# 将conf目录中的配置文件拷贝到 $MICRO_FRONTEND_FRAMEWORK static目录下
140-
cp $ROOT_PATH/conf/settings.json $FRAMEWORK_DEPLOY_PATH/static/settings.json
141-
cp $ROOT_PATH/conf/configs.json $FRAMEWORK_DEPLOY_PATH/static/configs.json
153+
cp "$ROOT_PATH"/conf/settings.json "$FRAMEWORK_DEPLOY_PATH"/static/settings.json
154+
cp "$ROOT_PATH"/conf/configs.json "$FRAMEWORK_DEPLOY_PATH"/static/configs.json
142155
LOG_INFO "$MICRO_FRONTEND_FRAMEWORK 配置完毕"
143156
}
144157

@@ -149,7 +162,7 @@ function init_web_nginx() {
149162
if [ "$IS_DOCKER" == "TRUE" ]; then
150163
SET_DEFAULT_SERVER="default_server"
151164
fi
152-
apps=$(echo $MICRO_FRONTEND_APPS | sed 's/[ ]/\\|/g')
165+
apps=$(echo "$MICRO_FRONTEND_APPS" | sed 's/[ ]/\\|/g')
153166
sed \
154167
"
155168
s|SERVER_NAME|$INGRESS_SERVER_NAME|g; \
@@ -162,15 +175,15 @@ function init_web_nginx() {
162175
s|MICRO_FRONTEND_DOCUMENT|$MICRO_FRONTEND_DOCUMENT|g; \
163176
s|MICRO_FRONTEND_APPS|$apps|g; \
164177
" \
165-
$ROOT_PATH/nginx/ingress.conf >$NGINX_CONF_PATH/tca_ingress.conf
178+
"$ROOT_PATH"/nginx/ingress.conf >"$NGINX_CONF_PATH"/tca_ingress.conf
166179
}
167180

168181
# 启动nginx
169182
function start() {
170183
LOG_INFO "启动 nginx ..."
171184
# wc -l 行数计算。当nginx无进程时,启动nginx,否则reload nginx
172185
nginx_is_start=$(ps -C nginx --no-header | wc -l)
173-
if [ $nginx_is_start -eq 0 ]; then
186+
if [ "$nginx_is_start" -eq 0 ]; then
174187
nginx -t
175188
if [ "$IS_DOCKER" == "TRUE" ]; then
176189
nginx -g "daemon off;"

0 commit comments

Comments
 (0)