#!/bin/bash

echo "🔧 设置 Electron 镜像源..."
echo ""

# 设置 Electron 镜像环境变量
export ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/
export ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/
export ELECTRON_CUSTOM_DIR='{{ version }}'
export ELECTRON_CUSTOM_FILENAME='{{ filename }}'

echo "✅ 环境变量已设置:"
echo "  ELECTRON_MIRROR: $ELECTRON_MIRROR"
echo "  ELECTRON_BUILDER_BINARIES_MIRROR: $ELECTRON_BUILDER_BINARIES_MIRROR"
echo ""

echo "🚀 开始打包 Mac 版本..."
echo ""

npm run pack:mac

if [ $? -eq 0 ]; then
    echo ""
    echo "✅ 打包成功！"
else
    echo ""
    echo "❌ 打包失败，请检查错误信息"
fi
