feat: add cross-platform start.sh script and update package.json for macOS/Linux

Former-commit-id: 3888c91ab3
This commit is contained in:
anoracleofra-code
2026-03-04 23:12:14 -07:00
parent 362a6e2ceb
commit 982a335d3f
5 changed files with 96 additions and 5 deletions
+4 -2
View File
@@ -143,9 +143,11 @@ Built with **Next.js**, **MapLibre GL**, **FastAPI**, and **Python**, it's desig
If you just want to run the dashboard without dealing with terminal commands:
1. Go to the **[Releases](../../releases)** tab on the right side of this GitHub page.
2. Download the `ShadowBroker_vX.X.zip` file.
2. Download the `ShadowBroker_v0.1.zip` file.
3. Extract the folder to your computer.
4. Double-click the **`start.bat`** file. It will automatically install everything and launch the dashboard!
4. **Windows:** Double-click `start.bat`.
**Mac/Linux:** Open terminal, type `chmod +x start.sh`, and run `./start.sh`.
5. It will automatically install everything and launch the dashboard!
---
+1 -1
View File
@@ -1 +1 @@
26acc242a5d0a3af1c67ce51279ea66ddf4d9daf
ba57965389036194d6dd60e6de33d2e1e1bbf20b
+37
View File
@@ -0,0 +1,37 @@
import os
import zipfile
zip_name = 'ShadowBroker_v0.1.zip'
if os.path.exists(zip_name):
try:
os.remove(zip_name)
except Exception as e:
print(f"Failed to delete old zip: {e}")
def add_dir(zipf, dir_path, excludes):
for root, dirs, files in os.walk(dir_path):
dirs[:] = [d for d in dirs if d not in excludes]
for f in files:
file_path = os.path.join(root, f)
zipf.write(file_path, arcname=file_path)
try:
with zipfile.ZipFile(zip_name, 'w', zipfile.ZIP_DEFLATED) as zipf:
print("Zipping backend...")
add_dir(zipf, 'backend', {'venv', '__pycache__'})
print("Zipping frontend...")
add_dir(zipf, 'frontend', {'node_modules', '.next'})
print("Zipping root files...")
zipf.write('docker-compose.yml')
zipf.write('start.bat')
zipf.write('start.sh')
zipf.write('README.md')
final_size = os.path.getsize(zip_name) / (1024 * 1024)
print(f"\n✅ SUCCESS! Created {zip_name}. Final size: {final_size:.2f} MB")
except Exception as e:
print(f"\n❌ ERROR creating zip: {e}")
+2 -2
View File
@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "concurrently --names \"NEXT,API\" --prefix-colors \"cyan,yellow\" \"next dev\" \"cd ../backend && venv\\Scripts\\python.exe main.py\"",
"dev": "concurrently \"npm run dev:frontend\" \"cd ../backend && python -m uvicorn main:app --reload\"",
"dev:frontend": "next dev",
"dev:backend": "cd ../backend && venv\\Scripts\\python.exe main.py",
"build": "next build",
@@ -37,4 +37,4 @@
"tailwindcss": "^4",
"typescript": "^5"
}
}
}
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
echo "======================================================="
echo " S H A D O W B R O K E R - macOS / Linux Start "
echo "======================================================="
echo ""
# Check for Node.js
if ! command -v npm &> /dev/null; then
echo "[!] ERROR: npm is not installed. Please install Node.js (https://nodejs.org/)"
exit 1
fi
# Check for Python
if ! command -v python3 &> /dev/null; then
echo "[!] ERROR: python3 is not installed. Please install Python 3.10+ (https://python.org/)"
exit 1
fi
echo "[*] Setting up Backend Environment..."
cd backend
if [ ! -d "venv" ]; then
echo "[*] Creating Python Virtual Environment..."
python3 -m venv venv
fi
echo "[*] Installing Backend dependencies..."
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
# In case someone runs this in Git Bash on Windows
source venv/Scripts/activate
else
source venv/bin/activate
fi
pip install -r requirements.txt
cd ..
echo "[*] Setting up Frontend Environment..."
cd frontend
if [ ! -d "node_modules" ]; then
echo "[*] Installing Frontend dependencies..."
npm install
fi
echo ""
echo "======================================================="
echo " 🚀 Starting Services... "
echo " Dashboard will be available at: http://localhost:3000"
echo " Keep this window open! Note: Initial load takes ~10s "
echo "======================================================="
echo ""
# Start both services (npm run dev automatically calls the python backend on Mac/Linux if scripts are configured cross-platform)
npm run dev