-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-server.sh
More file actions
executable file
·66 lines (55 loc) · 1.82 KB
/
Copy pathstart-server.sh
File metadata and controls
executable file
·66 lines (55 loc) · 1.82 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
#!/bin/bash
# macOS specific handling
if [[ "$OSTYPE" == "darwin"* ]]; then
# Change to script directory
cd "$(dirname "$0")"
# Clear terminal for better presentation
clear
# Check if running in Terminal
if [ "$TERM_PROGRAM" = "" ]; then
# Not running in terminal, launch with Terminal
osascript -e "tell application \"Terminal\" to do script \"cd '$(pwd)' && bash '$0'\""
exit 0
fi
fi
echo "╔══════════════════════════════════════╗"
echo "║ Script Manager Web ║"
echo "║ Shell Launcher ║"
echo "╚══════════════════════════════════════╝"
echo
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "❌ ERROR: Node.js is not installed"
echo " Please install Node.js from https://nodejs.org/"
echo
read -p "Press Enter to exit..."
exit 1
fi
echo "✅ Node.js version: $(node --version)"
echo "✅ npm version: $(npm --version)"
echo
# Check if dependencies are installed
if [ ! -d "node_modules" ]; then
echo "📦 Installing dependencies..."
npm install
if [ $? -ne 0 ]; then
echo "❌ ERROR: Failed to install dependencies"
read -p "Press Enter to exit..."
exit 1
fi
echo
fi
echo "🚀 Starting Script Manager Web Server..."
echo "🌐 Server will be available at: http://localhost:3000"
echo "🔧 Press Ctrl+C to stop the server"
echo
# Open browser after a delay
(sleep 3 && open http://localhost:3000) &
# Start the server
node backend/server.js
# Keep terminal open on error
if [ $? -ne 0 ]; then
echo
echo "❌ ERROR: Server failed to start"
read -p "Press Enter to exit..."
fi