-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
133 lines (120 loc) · 4.35 KB
/
Copy pathbuild.sh
File metadata and controls
133 lines (120 loc) · 4.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/usr/bin/env bash
# fuelle build script — macOS and Linux
# Usage: bash build.sh [mac|linux|all]
PLATFORM="${1:-detect}"
RED='\033[0;31m'; GREEN='\033[0;32m'; BOLD='\033[1m'; NC='\033[0m'
# Keep terminal open if double-clicked from file manager (Linux)
LAUNCHED_FROM_FILEMANAGER=false
if [ -z "$TERM" ] || [ "$TERM" = "dumb" ]; then
LAUNCHED_FROM_FILEMANAGER=true
fi
pause_if_needed() {
if [ "$LAUNCHED_FROM_FILEMANAGER" = true ]; then
echo ""
read -p "Press Enter to close..." dummy
fi
}
echo ""
echo -e "${BOLD} fuelle — Build Script${NC}"
echo " ========================"
echo ""
# ── Detect platform ───────────────────────────────────────────────────────────
detect_os() {
case "$(uname -s)" in
Darwin) echo "mac" ;;
Linux) echo "linux" ;;
*) echo "unknown" ;;
esac
}
[ "$PLATFORM" = "detect" ] && PLATFORM=$(detect_os)
echo -e " Platform: ${GREEN}$PLATFORM${NC}"
echo ""
# ── Check Node.js — just tell them to install it, no auto-install ─────────────
echo "[1/3] Checking for Node.js..."
if ! command -v node &>/dev/null; then
echo ""
echo -e " ${RED}[ERROR] Node.js is not installed.${NC}"
echo ""
if [ "$PLATFORM" = "mac" ]; then
echo " Install it from: https://nodejs.org/en/download"
echo " Choose the macOS installer (.pkg) — do NOT use Homebrew."
echo " After installing, open a new Terminal and run this script again."
else
echo " Install it by running these two commands:"
echo ""
echo " curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -"
echo " sudo apt-get install -y nodejs"
echo ""
echo " Then run this script again."
fi
echo ""
pause_if_needed
exit 1
fi
NODE_VER=$(node --version)
NPM_VER=$(npm --version)
echo -e " [OK] Node.js ${GREEN}$NODE_VER${NC} | npm ${GREEN}v$NPM_VER${NC}"
echo ""
# ── Install dependencies ──────────────────────────────────────────────────────
echo "[2/3] Installing dependencies..."
echo " (First run downloads ~200MB — this may take a few minutes)"
echo ""
npm install
if [ $? -ne 0 ]; then
echo -e "${RED}[ERROR] npm install failed. Check your internet connection.${NC}"
pause_if_needed
exit 1
fi
echo ""
echo -e " [OK] Dependencies ready."
echo ""
# ── Build ─────────────────────────────────────────────────────────────────────
echo "[3/3] Building..."
echo ""
case "$PLATFORM" in
mac)
npm run build:mac
if [ $? -ne 0 ]; then
echo -e "${RED}[ERROR] Build failed.${NC}"
pause_if_needed; exit 1
fi
echo ""
echo " Done! App is at: dist-electron/fuelle-0.6.0.dmg"
open dist-electron 2>/dev/null || true
;;
linux)
# Install Linux build deps if on apt-based system
if command -v apt-get &>/dev/null; then
echo " Installing Linux build dependencies..."
sudo apt-get install -y --no-install-recommends \
libgtk-3-dev libnotify-dev libnss3 libxss1 \
libxtst6 xdg-utils libatspi2.0-0 rpm fakeroot 2>/dev/null || true
echo ""
fi
npm run build:linux
if [ $? -ne 0 ]; then
echo -e "${RED}[ERROR] Build failed.${NC}"
pause_if_needed; exit 1
fi
echo ""
echo " Done! Packages are in: dist-electron/"
echo " .deb — install with: sudo dpkg -i dist-electron/*.deb"
echo " .AppImage — run with: chmod +x dist-electron/*.AppImage && ./dist-electron/*.AppImage"
xdg-open dist-electron 2>/dev/null || true
;;
all)
npm run build:all
if [ $? -ne 0 ]; then
echo -e "${RED}[ERROR] Build failed.${NC}"
pause_if_needed; exit 1
fi
echo ""
echo " Done! Output in: dist-electron/"
;;
*)
echo -e "${RED}Usage: bash build.sh [mac|linux|all]${NC}"
pause_if_needed; exit 1
;;
esac
echo ""
pause_if_needed