start-mac.command 634 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. set -euo pipefail
  3. cd "$(dirname "$0")"
  4. if ! command -v node >/dev/null 2>&1; then
  5. echo "未找到 Node.js。请先安装 Node.js 20+:https://nodejs.org/"
  6. echo
  7. read -r -p "按回车退出…" _
  8. exit 1
  9. fi
  10. if [ -d node_modules ] && [ -d node_modules/electron/dist ] && [ ! -d node_modules/electron/dist/Electron.app ]; then
  11. echo "检测到非 macOS 的 Electron 依赖,重新安装…"
  12. rm -rf node_modules
  13. fi
  14. if [ ! -d node_modules ]; then
  15. echo "首次运行,安装依赖…"
  16. npm install
  17. fi
  18. if [ ! -f resources/bin/luatos-cli ]; then
  19. echo "下载 luatos-cli…"
  20. npm run fetch:cli
  21. fi
  22. npm start