Files
cutThink_lite/scripts/check-build.sh

164 lines
3.5 KiB
Bash
Raw Normal View History

#!/bin/bash
# Build status check script for CutThenThink Lite
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
echo "Checking build status for CutThenThink Lite..."
echo ""
# Check function
check() {
if [ $? -eq 0 ]; then
echo -e "${GREEN}${NC} $1"
else
echo -e "${RED}${NC} $1"
return 1
fi
}
# Check Node.js
echo "Checking Node.js..."
if command -v node &> /dev/null; then
NODE_VERSION=$(node --version)
check "Node.js installed ($NODE_VERSION)"
else
echo -e "${RED}${NC} Node.js not installed"
fi
# Check npm
echo ""
echo "Checking npm..."
if command -v npm &> /dev/null; then
NPM_VERSION=$(npm --version)
check "npm installed ($NPM_VERSION)"
else
echo -e "${RED}${NC} npm not installed"
fi
# Check Rust
echo ""
echo "Checking Rust..."
if command -v rustc &> /dev/null; then
RUSTC_VERSION=$(rustc --version)
check "Rust installed ($RUSTC_VERSION)"
else
echo -e "${RED}${NC} Rust not installed"
echo -e "${YELLOW} Install from: https://rustup.rs/${NC}"
fi
if command -v cargo &> /dev/null; then
CARGO_VERSION=$(cargo --version)
check "Cargo installed ($CARGO_VERSION)"
else
echo -e "${RED}${NC} Cargo not installed"
fi
# Check Tauri CLI
echo ""
echo "Checking Tauri CLI..."
if command -v tauri &> /dev/null; then
TAURI_VERSION=$(tauri --version || echo "unknown")
check "Tauri CLI installed ($TAURI_VERSION)"
else
echo -e "${YELLOW}${NC} Tauri CLI not found (will be installed by npm)"
fi
# Check Linux dependencies (Linux only)
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo ""
echo "Checking Linux dependencies..."
DEPS=(
"libgtk-3-dev"
"libwebkit2gtk-4.0-dev"
"libappindicator3-dev"
"librsvg2-dev"
"patchelf"
)
MISSING=()
for dep in "${DEPS[@]}"; do
if dpkg -l | grep -q "$dep"; then
check "$dep installed"
else
echo -e "${RED}${NC} $dep not installed"
MISSING+=("$dep")
fi
done
if [ ${#MISSING[@]} -gt 0 ]; then
echo ""
echo -e "${YELLOW}Missing dependencies. Install with:${NC}"
echo "sudo apt-get install -y ${MISSING[*]}"
fi
fi
# Check project structure
echo ""
echo "Checking project structure..."
FILES=(
"package.json"
"vite.config.js"
"src-tauri/Cargo.toml"
"src-tauri/tauri.conf.json"
"src-tauri/src/main.rs"
"main.js"
"index.html"
)
for file in "${FILES[@]}"; do
if [ -f "$file" ]; then
check "$file exists"
else
echo -e "${RED}${NC} $file missing"
fi
done
# Check icons
echo ""
echo "Checking icons..."
ICONS=(
"src-tauri/icons/32x32.png"
"src-tauri/icons/128x128.png"
"src-tauri/icons/icon.ico"
"src-tauri/icons/icon.icns"
)
for icon in "${ICONS[@]}"; do
if [ -f "$icon" ]; then
check "$icon exists"
else
echo -e "${YELLOW}${NC} $icon missing (optional)"
fi
done
# Check node_modules
echo ""
echo "Checking dependencies..."
if [ -d "node_modules" ]; then
check "node_modules installed"
else
echo -e "${YELLOW}${NC} node_modules not found"
echo -e "${YELLOW} Run: npm install${NC}"
fi
# Summary
echo ""
echo -e "${GREEN}================================${NC}"
echo "Build status check complete!"
echo -e "${GREEN}================================${NC}"
echo ""
echo "Next steps:"
echo " 1. Install missing dependencies (if any)"
echo " 2. Run: npm install"
echo " 3. Run: npm run build"
echo " 4. Run: npm run tauri:build"