diff --git a/visualization/scripts/build.ps1 b/visualization/scripts/build.ps1 new file mode 100644 index 0000000..1798f7c --- /dev/null +++ b/visualization/scripts/build.ps1 @@ -0,0 +1,79 @@ +#!/usr/bin/env pwsh +# Build script for Windows (PowerShell) + +param( + [string]$Command = "build" +) + +function Build { + Write-Host "Building project..." -ForegroundColor Green + + # Create dist directory if it doesn't exist + if (!(Test-Path "dist")) { + New-Item -ItemType Directory -Path "dist" | Out-Null + } + + # Build bundle.js using browserify + Write-Host "Building bundle.js..." -ForegroundColor Yellow + if (Get-Command browserify -ErrorAction SilentlyContinue) { + browserify src/index.js -o dist/bundle.js + if ($LASTEXITCODE -eq 0) { + Write-Host "✓ bundle.js built successfully" -ForegroundColor Green + } else { + Write-Host "✗ Failed to build bundle.js" -ForegroundColor Red + exit 1 + } + } else { + Write-Host "✗ browserify not found. Please install it with: npm install -g browserify" -ForegroundColor Red + exit 1 + } + + # Build index.html using pug + Write-Host "Building index.html..." -ForegroundColor Yellow + if (Get-Command pug -ErrorAction SilentlyContinue) { + pug src/index.pug -o dist/ + if ($LASTEXITCODE -eq 0) { + Write-Host "✓ index.html built successfully" -ForegroundColor Green + } else { + Write-Host "✗ Failed to build index.html" -ForegroundColor Red + exit 1 + } + } else { + Write-Host "✗ pug not found. Please install it with: npm install -g pug-cli" -ForegroundColor Red + exit 1 + } + + Write-Host "Build completed successfully!" -ForegroundColor Green +} + +function Clean { + Write-Host "Cleaning build artifacts..." -ForegroundColor Yellow + + if (Test-Path "dist") { + Remove-Item -Recurse -Force "dist" + Write-Host "✓ dist directory removed" -ForegroundColor Green + } else { + Write-Host "dist directory doesn't exist, nothing to clean" -ForegroundColor Yellow + } +} + +function Show-Help { + Write-Host "Usage: .\build.ps1 [command]" -ForegroundColor Cyan + Write-Host "" + Write-Host "Commands:" -ForegroundColor Cyan + Write-Host " build Build the project (default)" -ForegroundColor White + Write-Host " clean Remove build artifacts" -ForegroundColor White + Write-Host " help Show this help message" -ForegroundColor White +} + +# Main script logic +switch ($Command.ToLower()) { + "build" { Build } + "clean" { Clean } + "help" { Show-Help } + default { + Write-Host "Unknown command: $Command" -ForegroundColor Red + Show-Help + exit 1 + } +} diff --git a/visualization/scripts/build.sh b/visualization/scripts/build.sh new file mode 100644 index 0000000..ecbe235 --- /dev/null +++ b/visualization/scripts/build.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# Build script for Unix/Linux systems + +set -e # Exit on any error + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +CYAN='\033[0;36m' +NC='\033[0m' # No Color + +function build() { + echo -e "${GREEN}Building project...${NC}" + + # Create dist directory if it doesn't exist + mkdir -p dist + + # Build bundle.js using browserify + echo -e "${YELLOW}Building bundle.js...${NC}" + if command -v browserify &> /dev/null; then + browserify src/index.js -o dist/bundle.js + echo -e "${GREEN}✓ bundle.js built successfully${NC}" + else + echo -e "${RED}✗ browserify not found. Please install it with: npm install -g browserify${NC}" + exit 1 + fi + + # Build index.html using pug + echo -e "${YELLOW}Building index.html...${NC}" + if command -v pug &> /dev/null; then + pug src/index.pug -o dist/ + echo -e "${GREEN}✓ index.html built successfully${NC}" + else + echo -e "${RED}✗ pug not found. Please install it with: npm install -g pug-cli${NC}" + exit 1 + fi + + echo -e "${GREEN}Build completed successfully!${NC}" +} + +function clean() { + echo -e "${YELLOW}Cleaning build artifacts...${NC}" + + if [ -d "dist" ]; then + rm -rf dist + echo -e "${GREEN}✓ dist directory removed${NC}" + else + echo -e "${YELLOW}dist directory doesn't exist, nothing to clean${NC}" + fi +} + +function show_help() { + echo -e "${CYAN}Usage: ./build.sh [command]${NC}" + echo "" + echo -e "${CYAN}Commands:${NC}" + echo -e " build Build the project (default)" + echo -e " clean Remove build artifacts" + echo -e " help Show this help message" +} + +# Main script logic +case "${1:-build}" in + build) + build + ;; + clean) + clean + ;; + help|--help|-h) + show_help + ;; + *) + echo -e "${RED}Unknown command: $1${NC}" + show_help + exit 1 + ;; +esac