feat(quick-4): update start.sh for dual-mode and dev:9999
- Add menu option 4) dev:9999 for remote HD mode (port 9999) - Renumber menu options 5-11 to accommodate new option - Add run_dual_mode() function that starts both 8888 and 9999 servers - Modify script to default to dual-mode when run without arguments - Show connection info for both kiosks and remote HD modes
This commit is contained in:
81
start.sh
81
start.sh
@@ -43,13 +43,14 @@ show_menu() {
|
||||
echo -e " ${GREEN}1)${NC} dev Start development server (port $DEV_PORT)"
|
||||
echo -e " ${GREEN}2)${NC} dev:8888 Start dev server on port 8888 (kiosk mode)"
|
||||
echo -e " ${GREEN}3)${NC} dev:9090 Start dev server on port 9090 (remote mode)"
|
||||
echo -e " ${GREEN}4)${NC} test Run tests"
|
||||
echo -e " ${GREEN}5)${NC} test:watch Run tests in watch mode"
|
||||
echo -e " ${GREEN}6)${NC} build Build for production"
|
||||
echo -e " ${GREEN}7)${NC} preview Preview production (port $PREVIEW_PORT)"
|
||||
echo -e " ${GREEN}8)${NC} lint Run linter"
|
||||
echo -e " ${GREEN}9)${NC} clean Clean build artifacts"
|
||||
echo -e " ${GREEN}10)${NC} install Install dependencies"
|
||||
echo -e " ${GREEN}4)${NC} dev:9999 Start dev server on port 9999 (remote HD mode)"
|
||||
echo -e " ${GREEN}5)${NC} test Run tests"
|
||||
echo -e " ${GREEN}6)${NC} test:watch Run tests in watch mode"
|
||||
echo -e " ${GREEN}7)${NC} build Build for production"
|
||||
echo -e " ${GREEN}8)${NC} preview Preview production (port $PREVIEW_PORT)"
|
||||
echo -e " ${GREEN}9)${NC} lint Run linter"
|
||||
echo -e " ${GREEN}10)${NC} clean Clean build artifacts"
|
||||
echo -e " ${GREEN}11)${NC} install Install dependencies"
|
||||
echo -e " ${GREEN}p)${NC} port Change default port"
|
||||
echo ""
|
||||
echo -e " ${RED}0)${NC} Exit"
|
||||
@@ -106,6 +107,44 @@ run_preview_server() {
|
||||
wait $PREVIEW_PID
|
||||
}
|
||||
|
||||
run_dual_mode() {
|
||||
local IP=$(get_ip_address)
|
||||
echo -e "${CYAN}${BOLD}"
|
||||
echo "╔══════════════════════════════════════════════════════╗"
|
||||
echo "║ TCK RTU - Dual Mode (Kiosk + Remote HD) ║"
|
||||
echo "╚══════════════════════════════════════════════════════╝"
|
||||
echo -e "${NC}"
|
||||
echo -e "${BLUE}Starting servers on ports 8888 and 9999...${NC}"
|
||||
echo -e "${YELLOW}(Press Ctrl+C to stop both servers)${NC}"
|
||||
echo ""
|
||||
|
||||
# Start kiosk server on port 8888
|
||||
cd "$PROJECT_DIR"
|
||||
npm run dev -- --host --port 8888 &
|
||||
KIOSK_PID=$!
|
||||
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "${GREEN} Kiosk Server (8888) started (PID: $KIOSK_PID)${NC}"
|
||||
|
||||
# Start remote HD server on port 9999
|
||||
npm run dev -- --host --port 9999 &
|
||||
REMOTE_PID=$!
|
||||
echo -e "${GREEN} Remote HD Server (9999) started (PID: $REMOTE_PID)${NC}"
|
||||
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo ""
|
||||
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "${GREEN} Dual-mode servers running:${NC}"
|
||||
echo -e "${GREEN} - Kiosk (local touchscreen): http://localhost:8888${NC}"
|
||||
echo -e "${GREEN} - Remote HD (desktop): http://localhost:9999${NC}"
|
||||
echo ""
|
||||
echo -e "${GREEN} - Network Kiosk: http://$IP:8888${NC}"
|
||||
echo -e "${GREEN} - Network Remote HD: http://$IP:9999${NC}"
|
||||
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo ""
|
||||
|
||||
# Wait for both processes
|
||||
wait $KIOSK_PID $REMOTE_PID
|
||||
}
|
||||
|
||||
change_port() {
|
||||
echo -e "${BOLD}Change Default Port${NC}"
|
||||
echo ""
|
||||
@@ -141,33 +180,36 @@ run_command() {
|
||||
3|dev:9090)
|
||||
run_dev_server 9090
|
||||
;;
|
||||
4|test)
|
||||
4|dev:9999)
|
||||
run_dev_server 9999
|
||||
;;
|
||||
5|test)
|
||||
echo -e "${BLUE}Running tests...${NC}"
|
||||
npm test
|
||||
;;
|
||||
5|test:watch)
|
||||
6|test:watch)
|
||||
echo -e "${BLUE}Running tests in watch mode...${NC}"
|
||||
npm run test:watch
|
||||
;;
|
||||
6|build)
|
||||
7|build)
|
||||
echo -e "${BLUE}Building for production...${NC}"
|
||||
npm run build
|
||||
echo -e "${GREEN}Build complete!${NC}"
|
||||
;;
|
||||
7|preview)
|
||||
8|preview)
|
||||
run_preview_server $PREVIEW_PORT
|
||||
;;
|
||||
8|lint)
|
||||
9|lint)
|
||||
echo -e "${BLUE}Running linter...${NC}"
|
||||
npm run lint
|
||||
;;
|
||||
9|clean)
|
||||
10|clean)
|
||||
echo -e "${YELLOW}Cleaning build artifacts...${NC}"
|
||||
rm -rf "$PROJECT_DIR/dist"
|
||||
rm -rf "$PROJECT_DIR/node_modules/.vite"
|
||||
echo -e "${GREEN}Clean complete!${NC}"
|
||||
;;
|
||||
10|install)
|
||||
11|install)
|
||||
echo -e "${BLUE}Installing dependencies...${NC}"
|
||||
npm install
|
||||
echo -e "${GREEN}Dependencies installed!${NC}"
|
||||
@@ -210,12 +252,5 @@ if [ $# -gt 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Interactive menu
|
||||
while true; do
|
||||
show_menu
|
||||
echo -n -e "${BOLD}Enter your choice (0-10 or p): ${NC}"
|
||||
read -r choice
|
||||
echo ""
|
||||
run_command "$choice"
|
||||
echo ""
|
||||
done
|
||||
# No arguments: start dual-mode (both 8888 and 9999)
|
||||
run_dual_mode
|
||||
|
||||
Reference in New Issue
Block a user