优化编译格式

This commit is contained in:
yml2213
2026-06-26 15:29:26 +08:00
parent e9621df0b9
commit bb24858e2b
4 changed files with 22 additions and 9 deletions
+14 -7
View File
@@ -94,7 +94,8 @@ dev_mode() {
# 生产构建
build_production() {
local VERSION=$(get_version)
info "开始生产构建 v${VERSION}"
local BUILD_TIME=$(date '+%Y-%m-%d %H:%M:%S')
info "开始生产构建 v${VERSION} 构建时间=${BUILD_TIME}"
# 类型检查
info "TypeScript 类型检查..."
@@ -102,8 +103,8 @@ build_production() {
npm run type-check
cd ..
# Wails 构建
wails build
# Wails 构建,注入构建时间
wails build -ldflags "-X 'douyu_go/internal/constants.BuildTime=${BUILD_TIME}'"
success "构建完成!"
echo ""
@@ -114,9 +115,12 @@ build_production() {
# 构建 Windows 版本
build_windows() {
local VERSION=$(get_version)
info "构建 Windows 版本 v${VERSION}"
local BUILD_TIME=$(date '+%Y-%m-%d %H:%M:%S')
local DATE_TAG=$(date '+%y.%-m.%-d')
local OUTPUT_NAME="douyu_go_v${VERSION}_${DATE_TAG}.exe"
info "构建 Windows 版本 v${VERSION} 构建时间=${BUILD_TIME}"
GOOS=windows GOARCH=amd64 wails build -platform windows/amd64 -o "douyu_go_v${VERSION}.exe"
GOOS=windows GOARCH=amd64 wails build -platform windows/amd64 -o "${OUTPUT_NAME}" -ldflags "-X 'douyu_go/internal/constants.BuildTime=${BUILD_TIME}'"
success "Windows 构建完成!"
echo ""
@@ -127,9 +131,12 @@ build_windows() {
# 构建 Linux 版本
build_linux() {
local VERSION=$(get_version)
info "构建 Linux 版本 v${VERSION}"
local BUILD_TIME=$(date '+%Y-%m-%d %H:%M:%S')
local DATE_TAG=$(date '+%y.%-m.%-d')
local OUTPUT_NAME="douyu_go_v${VERSION}_${DATE_TAG}"
info "构建 Linux 版本 v${VERSION} 构建时间=${BUILD_TIME}"
GOOS=linux GOARCH=amd64 wails build -platform linux/amd64 -o "douyu_go_v${VERSION}"
GOOS=linux GOARCH=amd64 wails build -platform linux/amd64 -o "${OUTPUT_NAME}" -ldflags "-X 'douyu_go/internal/constants.BuildTime=${BUILD_TIME}'"
success "Linux 构建完成!"
echo ""