优化结构目录,新增部署脚本,一键上传s3 和刷新 cdn

This commit is contained in:
eafonyang
2026-06-18 16:12:46 +08:00
parent e8b19a5897
commit 3968639f4d
38 changed files with 114 additions and 567 deletions
+1
View File
@@ -0,0 +1 @@
strict-peer-dependencies=false

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Before

Width:  |  Height:  |  Size: 439 B

After

Width:  |  Height:  |  Size: 439 B

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 673 B

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 275 KiB

After

Width:  |  Height:  |  Size: 275 KiB

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 222 KiB

Before

Width:  |  Height:  |  Size: 195 KiB

After

Width:  |  Height:  |  Size: 195 KiB

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 166 KiB

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 141 KiB

Before

Width:  |  Height:  |  Size: 402 KiB

After

Width:  |  Height:  |  Size: 402 KiB

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

Before

Width:  |  Height:  |  Size: 208 KiB

After

Width:  |  Height:  |  Size: 208 KiB

Before

Width:  |  Height:  |  Size: 208 KiB

After

Width:  |  Height:  |  Size: 208 KiB

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Before

Width:  |  Height:  |  Size: 386 KiB

After

Width:  |  Height:  |  Size: 386 KiB

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Before

Width:  |  Height:  |  Size: 454 KiB

After

Width:  |  Height:  |  Size: 454 KiB

+6 -6
View File
@@ -839,7 +839,7 @@ export default function Home() {
onClick={() => updateSetting({ bt_next: 0 })}
className="w-10 h-10 rounded-full flex items-center justify-center transition-all active:scale-95"
style={{ background: "rgba(0,255,246,0.15)", border: "1px solid rgba(0,255,246,0.3)" }}>
<img src={`${import.meta.env.BASE_URL}player/skip-forward.png`} alt="上一首" className="w-5 h-5" />
<img src={`${import.meta.env.BASE_URL}images/player/skip-forward.png`} alt="上一首" className="w-5 h-5" />
</button>
<button
onClick={() => updateSetting({ bt_play: 1 })}
@@ -847,8 +847,8 @@ export default function Home() {
style={{ background: "transparent", border: "1px solid rgba(0,255,246,0.5)", boxShadow: "0 0 12px rgba(0,255,246,0.4)" }}>
<img
src={ds.bt_status === 1
? `${import.meta.env.BASE_URL}player/play.png`
: `${import.meta.env.BASE_URL}player/pause.png`}
? `${import.meta.env.BASE_URL}images/player/play.png`
: `${import.meta.env.BASE_URL}images/player/pause.png`}
alt={ds.bt_status === 1 ? "播放" : "暂停"}
className="w-6 h-6"
/>
@@ -857,7 +857,7 @@ export default function Home() {
onClick={() => updateSetting({ bt_next: 1 })}
className="w-10 h-10 rounded-full flex items-center justify-center transition-all active:scale-95"
style={{ background: "rgba(0,255,246,0.15)", border: "1px solid rgba(0,255,246,0.3)" }}>
<img src={`${import.meta.env.BASE_URL}player/skip-back.png`} alt="下一首" className="w-5 h-5" />
<img src={`${import.meta.env.BASE_URL}images/player/skip-back.png`} alt="下一首" className="w-5 h-5" />
</button>
</div>
</div>
@@ -919,7 +919,7 @@ export default function Home() {
onClick={() => updateSetting({ dsp_enable: bypassOn ? 1 : 0 })}
>
<img
src={`${import.meta.env.BASE_URL}home/bypass.png`}
src={`${import.meta.env.BASE_URL}images/home/bypass.png`}
alt="Bypass"
className="w-[25px] h-[25px] object-contain"
style={{ opacity: bypassOn ? 1 : 0.6, transform: "translateX(1.5px)" }}
@@ -958,7 +958,7 @@ export default function Home() {
icon={<Gauge size={16} />}
label={homeText.vu ?? "VU表"}
value={vuLabel}
thumbnail={`${import.meta.env.BASE_URL}vu/vu${(ds.vu ?? 0) + 1}.png`}
thumbnail={`${import.meta.env.BASE_URL}images/vu/vu${(ds.vu ?? 0) + 1}.png`}
onClick={() => setLocation("/vu")}
/>
<ListRow
+1 -1
View File
@@ -62,7 +62,7 @@ import localeEn from "@/locales/data-en.json";
const iisModeImageUrl = (index: number) =>
`${import.meta.env.BASE_URL}IIS/iis_app${index + 1}.png`;
`${import.meta.env.BASE_URL}images/IIS/iis_app${index + 1}.png`;
+1 -1
View File
@@ -26,7 +26,7 @@ interface VUStyle {
const VU_STYLES: VUStyle[] = Array.from({ length: 16 }, (_, i) => ({
index: i,
name: `VU ${i + 1}`,
preview: `${import.meta.env.BASE_URL}vu/vu${i + 1}.png`,
preview: `${import.meta.env.BASE_URL}images/vu/vu${i + 1}.png`,
}));
export default function VUPage() {
+7 -559
View File
File diff suppressed because it is too large Load Diff
+98
View File
@@ -0,0 +1,98 @@
#!/bin/bash
# ============================================================
# 部署脚本 - 支持 test 环境与 images 目录排除
#
# 用法:
# ./scripts/deploy.sh 上传至正式环境 (v2)
# ./scripts/deploy.sh -test 上传至测试环境 (test)
# ./scripts/deploy.sh -eximg 排除 images 目录,上传至正式环境
# ./scripts/deploy.sh -eximg -test 排除 images 目录,上传至测试环境
# -reload 参数:上传完成后刷新 CloudFront 缓存
# ./scripts/deploy.sh -reload 上传正式环境并刷新缓存
# ./scripts/deploy.sh -eximg -test -reload 排除 images,上传测试环境并刷新缓存
# ============================================================
set -e
# 自动识别项目名称 (x8 / x9),依据脚本所在的项目根目录名
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(basename "$(dirname "$SCRIPT_DIR")")"
PROJECT_NAME="$(echo "$PROJECT_ROOT" | grep -oE '^(x8|x9)')"
if [ -z "$PROJECT_NAME" ]; then
echo "错误: 无法从路径 '$PROJECT_ROOT' 识别项目名称 (x8/x9)"
exit 1
fi
# 解析参数
TARGET_ENV="prod" # 默认正式环境
EXCLUDE_IMAGES=false # 默认不排除 images
RELOAD=false # 默认不刷新 CloudFront 缓存
for arg in "$@"; do
case "$arg" in
-test)
TARGET_ENV="test"
;;
-eximg)
EXCLUDE_IMAGES=true
;;
-reload)
RELOAD=true
;;
*)
echo "未知参数: $arg"
echo "用法: ./scripts/deploy.sh [-test] [-eximg] [-reload]"
exit 1
;;
esac
done
# 确定 S3 目标路径与 CloudFront 刷新路径
if [ "$TARGET_ENV" = "test" ]; then
S3_PATH="s3://luxsin-app-bucket/${PROJECT_NAME}/test/"
CF_PATH="/${PROJECT_NAME}/test/*"
else
S3_PATH="s3://luxsin-app-bucket/${PROJECT_NAME}/v2/"
CF_PATH="/${PROJECT_NAME}/v2/*"
fi
# CloudFront 分配 ID
DISTRIBUTION_ID="EUS4XQ8Y0W2ZV"
# 构建 aws s3 sync 命令参数(使用数组,避免引号转义问题)
CMD_ARGS=("aws" "s3" "sync" "./dist" "$S3_PATH" "--delete")
if [ "$EXCLUDE_IMAGES" = true ]; then
CMD_ARGS+=("--exclude" "*images/*")
fi
# 输出部署信息
echo "=========================================="
echo "项目: ${PROJECT_NAME}"
echo "环境: ${TARGET_ENV}"
echo "目标: ${S3_PATH}"
[ "$EXCLUDE_IMAGES" = true ] && echo "排除: *images/*"
echo "刷新: ${RELOAD}"
echo "命令: ${CMD_ARGS[*]}"
echo "=========================================="
echo ""
# 执行同步
"${CMD_ARGS[@]}"
echo ""
# 刷新 CloudFront 缓存
if [ "$RELOAD" = true ]; then
echo "刷新 CloudFront 缓存..."
echo "路径: ${CF_PATH}"
aws cloudfront create-invalidation \
--distribution-id "$DISTRIBUTION_ID" \
--paths "$CF_PATH"
echo ""
echo "CloudFront 缓存刷新完成!"
fi
echo "部署完成!"