diff --git a/build/icon.svg b/build/icon.svg new file mode 100644 index 0000000..f8cafb3 --- /dev/null +++ b/build/icon.svg @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + R + + + + + + + + + + + + + + diff --git a/build/icons/icon_128.png b/build/icons/icon_128.png new file mode 100644 index 0000000..94c7d9f Binary files /dev/null and b/build/icons/icon_128.png differ diff --git a/build/icons/icon_16.png b/build/icons/icon_16.png new file mode 100644 index 0000000..10e4f8c Binary files /dev/null and b/build/icons/icon_16.png differ diff --git a/build/icons/icon_256.png b/build/icons/icon_256.png new file mode 100644 index 0000000..0a63628 Binary files /dev/null and b/build/icons/icon_256.png differ diff --git a/build/icons/icon_32.png b/build/icons/icon_32.png new file mode 100644 index 0000000..e52aa43 Binary files /dev/null and b/build/icons/icon_32.png differ diff --git a/build/icons/icon_48.png b/build/icons/icon_48.png new file mode 100644 index 0000000..06f8bc1 Binary files /dev/null and b/build/icons/icon_48.png differ diff --git a/build/icons/icon_512.png b/build/icons/icon_512.png new file mode 100644 index 0000000..20c18d1 Binary files /dev/null and b/build/icons/icon_512.png differ diff --git a/build/icons/icon_64.png b/build/icons/icon_64.png new file mode 100644 index 0000000..65ae791 Binary files /dev/null and b/build/icons/icon_64.png differ diff --git a/package.json b/package.json index 980524d..c3d53da 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,40 @@ "build:linux": "npm run build && electron-builder --linux", "lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue --fix" }, + "build": { + "appId": "com.jokul.jredis-desktop", + "productName": "JRedisDesktop", + "directories": { + "output": "release" + }, + "files": [ + "out/**/*", + "package.json" + ], + "linux": { + "target": [ + "AppImage", + "deb" + ], + "icon": "build/icons", + "category": "Development" + }, + "mac": { + "target": [ + "dmg", + "zip" + ], + "icon": "build/icon.icns", + "category": "public.app-category.developer-tools" + }, + "win": { + "target": [ + "nsis", + "portable" + ], + "icon": "build/icon.ico" + } + }, "dependencies": { "electron-store": "^11.0.2", "ioredis": "^5.7.0", diff --git a/scripts/generate-icons.sh b/scripts/generate-icons.sh new file mode 100755 index 0000000..95fb3d0 --- /dev/null +++ b/scripts/generate-icons.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# scripts/generate-icons.sh - 从 SVG 生成各平台图标 + +set -e + +cd "$(dirname "$0")/.." || exit 1 + +SVG_FILE="build/icon.svg" +ICONS_DIR="build/icons" + +echo "⏳ 正在生成图标..." + +# 创建目录 +mkdir -p "$ICONS_DIR" + +# 生成各尺寸 PNG +for size in 16 32 48 64 128 256 512; do + rsvg-convert -w $size -h $size "$SVG_FILE" -o "$ICONS_DIR/icon_${size}.png" + echo " ✓ icon_${size}.png" +done + +# 生成 Windows ICO (使用 16, 32, 48, 256) +# 需要安装 icoutils: sudo apt install icoutils +if command -v icotool &> /dev/null; then + icotool -c -o build/icon.ico \ + "$ICONS_DIR/icon_16.png" \ + "$ICONS_DIR/icon_32.png" \ + "$ICONS_DIR/icon_48.png" \ + "$ICONS_DIR/icon_256.png" + echo " ✓ icon.ico" +else + echo " ⚠ icoutils 未安装,跳过 ICO 生成" + echo " 安装: sudo apt install icoutils" +fi + +# 生成 macOS ICNS (使用 iconutil) +# macOS 上可以直接用: iconutil -c icns icon.iconset +# Linux 上需要 dmgbuild 或者手动创建 + +echo "" +echo "✅ 图标生成完成!" +echo "" +echo "Windows ICO: build/icon.ico" +echo "macOS ICNS: build/icon.icns (需要在 macOS 上生成)" +echo "Linux PNG: build/icons/" diff --git a/src/main/index.ts b/src/main/index.ts index d032911..eacfe99 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -13,6 +13,7 @@ function createWindow(): void { minWidth: 900, minHeight: 600, title: 'JRedisDesktop', + icon: join(__dirname, '../../build/icons/icon_256.png'), backgroundColor: nativeTheme.shouldUseDarkColors ? '#0f0f1a' : '#f8fafc', webPreferences: { preload: join(__dirname, '../preload/index.mjs'),