Files
ServerManager/build.sh
T

93 lines
2.9 KiB
Bash
Executable File

#!/bin/bash
# ServerManager Pro - Simple Build Interface
# For daily development use
set -e
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
APP_NAME="ServerManager Pro"
VERSION=$(node -p "require('./package.json').version")
show_help() {
echo -e "${GREEN}$APP_NAME - Build Manager${NC}"
echo -e "Version: ${BLUE}$VERSION${NC}"
echo ""
echo "Usage: $0 [command]"
echo ""
echo "Commands:"
echo " build Build for Linux & Windows (production)"
echo " build-linux Build only Linux package"
echo " build-windows Build only Windows package"
echo " dev Start development mode"
echo " clean Remove build files"
echo " install-linux Install Linux package"
echo " status Show build status"
echo " version Show version"
echo ""
echo "Examples:"
echo " $0 build # Production build"
echo " $0 dev # Development mode"
echo " $0 install-linux # Install on Linux"
}
case "${1:-help}" in
"build")
echo -e "${GREEN}Building production packages...${NC}"
./build-prod.sh
;;
"build-linux")
echo -e "${GREEN}Building Linux package...${NC}"
./build-prod.sh linux
;;
"build-windows")
echo -e "${GREEN}Building Windows package...${NC}"
./build-prod.sh windows
;;
"dev")
echo -e "${GREEN}Starting development mode...${NC}"
npm run electron-dev
;;
"clean")
echo -e "${YELLOW}Cleaning build files...${NC}"
rm -rf build dist
echo -e "${GREEN}Clean complete${NC}"
;;
"install-linux")
DEB_FILE=$(find dist -name "*.deb" | head -1)
if [ -n "$DEB_FILE" ]; then
echo -e "${GREEN}Installing $(basename $DEB_FILE)...${NC}"
sudo dpkg -i "$DEB_FILE" || sudo apt-get install -f
echo -e "${GREEN}Installation complete!${NC}"
else
echo -e "${YELLOW}No .deb package found. Run './build.sh build' first.${NC}"
fi
;;
"status")
echo -e "${GREEN}Build Status${NC}"
echo "Version: $VERSION"
echo ""
if [ -d "build" ]; then
echo -e "React build: ${GREEN}✅ Present${NC}"
else
echo -e "React build: ${YELLOW}❌ Missing${NC}"
fi
echo -e "Packages:"
ls dist/*.deb 2>/dev/null && echo -e " ${GREEN}🐧 Linux: ✅ Present${NC}" || echo -e " ${YELLOW}🐧 Linux: ❌ Missing${NC}"
ls dist/*.exe 2>/dev/null && echo -e " ${GREEN}🪟 Windows: ✅ Present${NC}" || echo -e " ${YELLOW}🪟 Windows: ❌ Missing${NC}"
;;
"version")
echo -e "Version: ${GREEN}$VERSION${NC}"
;;
"help"|"--help"|"-h")
show_help
;;
*)
echo -e "${YELLOW}Unknown command: $1${NC}"
show_help
;;
esac