| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #!/usr/bin/env bash
- set -euo pipefail
- cd "$(dirname "$0")/.."
- if [ "$(uname -s)" != "Darwin" ]; then
- echo "此脚本需要在 macOS 上运行(electron-builder 不支持从 Windows/Linux 构建 macOS 包)。"
- exit 1
- fi
- if ! command -v node >/dev/null 2>&1; then
- echo "未找到 node。请先安装 Node.js 20+:https://nodejs.org/"
- exit 1
- fi
- if ! command -v npm >/dev/null 2>&1; then
- echo "未找到 npm。请先安装 Node.js 20+。"
- exit 1
- fi
- echo "==> 安装依赖"
- if [ -f package-lock.json ]; then
- npm ci
- else
- npm install
- fi
- if [ -f resources/bin/luatos-cli ]; then
- echo "==> 使用已内置的 luatos-cli(macOS universal)"
- else
- echo "==> 下载 luatos-cli(macOS universal)"
- npm run fetch:cli
- fi
- echo "==> 构建 .app / .dmg(unsigned)"
- npm run dist:mac
- echo
- echo "完成。产物在 dist/ 目录:"
- ls -lh dist/*.dmg dist/*.zip 2>/dev/null || true
- echo
- echo "如果 macOS 提示“无法验证开发者”,可以右键 App -> 打开,或执行:"
- echo ' xattr -cr "/Applications/LuatOS Flasher.app"'
|