-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·99 lines (86 loc) · 2.26 KB
/
build.sh
File metadata and controls
executable file
·99 lines (86 loc) · 2.26 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
#!/bin/bash
#
# Build script for HyperAide Browser Sync CLI
#
# This creates a standalone binary with bundled Chromium.
# The binary will be ~250MB but requires no dependencies to run.
#
# Usage:
# ./build.sh
#
# Output:
# dist/hyperaide-sync (or hyperaide-sync.exe on Windows)
#
set -e
echo "🔧 HyperAide Browser Sync CLI Builder"
echo "======================================"
echo ""
# Detect platform
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case "$ARCH" in
x86_64|amd64) ARCH="amd64" ;;
arm64|aarch64) ARCH="arm64" ;;
esac
BINARY_NAME="hyperaide-sync-${OS}-${ARCH}"
echo "Building for: ${OS}/${ARCH}"
echo "Binary name: ${BINARY_NAME}"
echo ""
# Check Python
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is required but not found"
exit 1
fi
PYTHON_VERSION=$(python3 --version)
echo "✓ Using ${PYTHON_VERSION}"
# Install dependencies if needed
echo ""
echo "📦 Installing dependencies..."
pip3 install -q -r requirements.txt
pip3 install -q pyinstaller
# Install Playwright browsers
echo ""
echo "🌐 Installing Chromium browser..."
python3 -m playwright install chromium
# Find Playwright driver location
echo ""
echo "🔍 Locating Playwright driver..."
PLAYWRIGHT_PATH=$(python3 -c "
import playwright
import os
driver_path = os.path.dirname(playwright.__file__)
print(driver_path)
")
echo " Playwright path: ${PLAYWRIGHT_PATH}"
# Build the binary
echo ""
echo "🏗️ Building binary (this may take a few minutes)..."
pyinstaller \
--onefile \
--name "${BINARY_NAME}" \
--add-data "${PLAYWRIGHT_PATH}/driver:playwright/driver" \
--hidden-import playwright \
--hidden-import playwright.sync_api \
--hidden-import playwright._impl \
--hidden-import playwright._impl._driver \
--collect-all playwright \
--noconfirm \
--clean \
main.py
# Check result
if [ -f "dist/${BINARY_NAME}" ]; then
SIZE=$(du -h "dist/${BINARY_NAME}" | cut -f1)
echo ""
echo "✅ Build successful!"
echo ""
echo " Binary: dist/${BINARY_NAME}"
echo " Size: ${SIZE}"
echo ""
echo "Test it with:"
echo " ./dist/${BINARY_NAME} --help"
echo " ./dist/${BINARY_NAME} --dev # Use localhost API"
else
echo ""
echo "❌ Build failed - binary not found"
exit 1
fi