chore: initial commit
- Wails v2 + Go 1.21+ + Vue 3 dark UI - 3 buttons: Check env (auto-install dsh) / Start dsh web / Stop - 升级 / 检查版本 一键按钮 - 启动后窗口自动最小化到 Dock - 顶部 logo 鼠标 hover 显示大图预览 - scripts/: build-mac.sh, build-windows.bat, install-app.sh - ui-design/: 视觉设计稿 (HTML + tokens)
This commit is contained in:
Executable
+61
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build dsh-launcher.app for macOS (universal arm64/x86_64).
|
||||
#
|
||||
# 用法: ./scripts/build-mac.sh
|
||||
#
|
||||
# 产物: build/bin/dsh-launcher.app
|
||||
# 安装: ./scripts/install-app.sh (拷贝到 /Applications/ + 刷新图标缓存)
|
||||
#
|
||||
# 注意: Wails v2 跨平台 build 需要在目标平台编译。
|
||||
# 想出 Windows 版,必须在 Windows 上跑 scripts/build-windows.bat。
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
echo "▶ dsh-launcher · macOS build"
|
||||
echo ""
|
||||
|
||||
# 1. 基础工具检查
|
||||
command -v go >/dev/null 2>&1 || { echo "✗ go not installed"; exit 1; }
|
||||
command -v node >/dev/null 2>&1 || { echo "✗ node not installed"; exit 1; }
|
||||
command -v npm >/dev/null 2>&1 || { echo "✗ npm not installed"; exit 1; }
|
||||
command -v wails >/dev/null 2>&1 || { echo "✗ wails not installed (go install github.com/wailsapp/wails/v2/cmd/wails@latest)"; exit 1; }
|
||||
|
||||
GOOS=$(go env GOOS)
|
||||
if [[ "${GOOS}" != "darwin" ]]; then
|
||||
echo "✗ must run on macOS (current: ${GOOS})"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 2. 同步前端依赖(版本变更后才需要,但每次跑更稳)
|
||||
echo "▶ npm install"
|
||||
(cd frontend && npm install)
|
||||
|
||||
# 3. 编译
|
||||
# -clean: 清掉 build/bin,确保 icns / Info.plist 跟当前源码一致
|
||||
# 不带 -platform: 当前平台 + 当前架构
|
||||
echo ""
|
||||
echo "▶ wails build"
|
||||
wails build -clean
|
||||
|
||||
# 4. 校验产物
|
||||
APP="build/bin/dsh-launcher.app"
|
||||
if [[ ! -d "${APP}" ]]; then
|
||||
echo "✗ ${APP} not found"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${APP}/Contents/Resources/iconfile.icns" ]]; then
|
||||
echo "✗ iconfile.icns missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ICON_SIZE=$(stat -f%z "${APP}/Contents/Resources/iconfile.icns")
|
||||
EXE_SIZE=$(stat -f%z "${APP}/Contents/MacOS/dsh-launcher")
|
||||
echo ""
|
||||
echo "✓ app: ${APP}"
|
||||
echo " binary: ${EXE_SIZE} bytes"
|
||||
echo " icon: ${ICON_SIZE} bytes"
|
||||
echo ""
|
||||
echo " open: open ${APP}"
|
||||
echo " install: ./scripts/install-app.sh"
|
||||
@@ -0,0 +1,87 @@
|
||||
@echo off
|
||||
REM Build dsh-launcher.exe for Windows (amd64).
|
||||
REM
|
||||
REM 用法: scripts\build-windows.bat
|
||||
REM
|
||||
REM 前置依赖(Windows 上装好后):
|
||||
REM - Go 1.21+ https://go.dev/dl/
|
||||
REM - Node.js 18+ https://nodejs.org/
|
||||
REM - Wails CLI go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||||
REM - WebView2 Runtime Win10 1803+ 自带,否则 https://aka.ms/webview2
|
||||
REM - MSVC build tools https://visualstudio.microsoft.com/downloads/ (Build Tools for Visual Studio, 勾选 "Desktop development with C++")
|
||||
REM
|
||||
REM 注意: Wails v2 的 Windows build 需要 MSVC toolchain (cgo 编译 webview2 loader)。
|
||||
REM 不能在 macOS / Linux 上 cross-compile 出 .exe。
|
||||
REM
|
||||
REM 产物: build\bin\dsh-launcher.exe
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
cd /d "%~dp0\.."
|
||||
|
||||
echo ^>^> dsh-launcher · Windows build
|
||||
echo.
|
||||
|
||||
REM 1. 基础工具检查
|
||||
where go >nul 2>nul
|
||||
if errorlevel 1 (
|
||||
echo [X] go not installed
|
||||
exit /b 1
|
||||
)
|
||||
where node >nul 2>nul
|
||||
if errorlevel 1 (
|
||||
echo [X] node not installed
|
||||
exit /b 1
|
||||
)
|
||||
where npm >nul 2>nul
|
||||
if errorlevel 1 (
|
||||
echo [X] npm not installed
|
||||
exit /b 1
|
||||
)
|
||||
where wails >nul 2>nul
|
||||
if errorlevel 1 (
|
||||
echo [X] wails CLI not installed - run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM 2. 检查 WINDOWS 环境
|
||||
if not "%OS%"=="Windows_NT" (
|
||||
echo [X] must run on Windows, current: %OS%
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM 3. 同步前端依赖
|
||||
echo ^>^> npm install
|
||||
cd frontend
|
||||
call npm install
|
||||
if errorlevel 1 (
|
||||
echo [X] npm install failed
|
||||
exit /b 1
|
||||
)
|
||||
cd ..
|
||||
|
||||
REM 4. 编译
|
||||
echo.
|
||||
echo ^>^> wails build
|
||||
wails build -clean -platform windows/amd64
|
||||
if errorlevel 1 (
|
||||
echo [X] wails build failed
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM 5. 校验产物
|
||||
set EXE=build\bin\dsh-launcher.exe
|
||||
if not exist "%EXE%" (
|
||||
echo [X] %EXE% not found
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo [OK] exe: %EXE%
|
||||
echo size: %~z1 bytes
|
||||
echo.
|
||||
echo run: %EXE%
|
||||
echo build dir: build\bin\
|
||||
echo.
|
||||
|
||||
endlocal
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
# 装 dsh-launcher.app 到 /Applications/,并强制刷新 macOS 图标。
|
||||
#
|
||||
# 背景: macOS LaunchServices 会把 com.wails.dsh-launcher 的图标缓存成
|
||||
# 当前 app 文件的快照。每次 wails build 之后 .app 内容重建,缓存可能不刷新,
|
||||
# 导致 Dock 显示默认 .app 占位图而不是真实 icns。
|
||||
#
|
||||
# 解决: 把 .app 复制到一个稳定路径(/Applications/),重建时先 rm 再 cp,
|
||||
# lsregister -f 强制重新注册。
|
||||
#
|
||||
# 用法: ./scripts/install-app.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
APP_NAME="dsh-launcher.app"
|
||||
SRC="build/bin/${APP_NAME}"
|
||||
DEST="/Applications/${APP_NAME}"
|
||||
|
||||
if [[ ! -d "${SRC}" ]]; then
|
||||
echo "✗ ${SRC} not found, run 'wails build' first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 1. 验证 icns 文件是新图
|
||||
if [[ ! -f "${SRC}/Contents/Resources/iconfile.icns" ]]; then
|
||||
echo "✗ iconfile.icns missing — icon wasn't packaged"
|
||||
exit 1
|
||||
fi
|
||||
ICON_SIZE=$(stat -f%z "${SRC}/Contents/Resources/iconfile.icns")
|
||||
if [[ ${ICON_SIZE} -lt 100000 ]]; then
|
||||
echo "⚠ iconfile.icns suspiciously small (${ICON_SIZE} bytes)"
|
||||
fi
|
||||
echo "✓ iconfile.icns: ${ICON_SIZE} bytes"
|
||||
|
||||
# 2. 删除旧版(让 lsregister 看到全新路径)
|
||||
if [[ -d "${DEST}" ]]; then
|
||||
rm -rf "${DEST}"
|
||||
fi
|
||||
|
||||
# 3. 复制到 /Applications
|
||||
cp -R "${SRC}" "${DEST}"
|
||||
echo "✓ copied to ${DEST}"
|
||||
|
||||
# 4. 强制重新注册到 LaunchServices
|
||||
LSREGISTER="/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister"
|
||||
"${LSREGISTER}" -f "${DEST}"
|
||||
|
||||
# 5. touch 一下让文件 mtime 更新
|
||||
/usr/bin/touch -c "${DEST}/Contents/Info.plist"
|
||||
/usr/bin/touch -c "${DEST}/Contents/Resources/iconfile.icns"
|
||||
|
||||
# 6. 清 Dock iconcache
|
||||
DOCK_CACHE=$(find /var/folders -name "com.apple.dock.iconcache" 2>/dev/null | head -1)
|
||||
if [[ -n "${DOCK_CACHE}" ]]; then
|
||||
rm -f "${DOCK_CACHE}"
|
||||
echo "✓ cleared dock iconcache"
|
||||
fi
|
||||
|
||||
# 7. 重启 Dock 强制重读
|
||||
killall Dock 2>/dev/null || true
|
||||
sleep 1
|
||||
|
||||
echo ""
|
||||
echo "✓ ${APP_NAME} installed at ${DEST}"
|
||||
echo " open it via Finder / Spotlight / Dock (re-add to Dock if needed)"
|
||||
Reference in New Issue
Block a user