From 3c92f2e5302aa77a755ea4f0a9aeca9db286050a Mon Sep 17 00:00:00 2001 From: "courtmanr@gmail.com" Date: Sun, 9 Mar 2025 18:59:59 +0000 Subject: [PATCH] Remove Windows screenshot functionality --- CHANGELOG.md | 1 - docs/SCREENSHOTS.md | 7 +- docs/SCREENSHOTS_WINDOWS.md | 108 ----------------------- package.json | 3 +- scripts/update-screenshots.ps1 | 151 --------------------------------- 5 files changed, 2 insertions(+), 268 deletions(-) delete mode 100644 docs/SCREENSHOTS_WINDOWS.md delete mode 100644 scripts/update-screenshots.ps1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 638c992c8..83bb745c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,6 @@ All notable changes to this project will be documented in this file. ## [1.3.0] - 2024-03-09 ### Added -- Windows support for screenshot automation tool - Dashboard screenshot to README - Ko-fi support button and Support section - Code of Conduct based on Contributor Covenant diff --git a/docs/SCREENSHOTS.md b/docs/SCREENSHOTS.md index d29a87821..179d0d5b9 100644 --- a/docs/SCREENSHOTS.md +++ b/docs/SCREENSHOTS.md @@ -7,11 +7,8 @@ This document explains how to use the screenshot automation tool to keep the doc The easiest way to update screenshots is to use the provided npm script: ```bash -# From the project root (macOS/Linux) +# From the project root npm run screenshots - -# From the project root (Windows) -npm run screenshots:win ``` This script will: @@ -21,8 +18,6 @@ This script will: 4. Save the screenshots to the `docs/images` directory 5. Clean up by stopping any servers it started -> **Windows Users**: For detailed instructions specific to Windows, please see [SCREENSHOTS_WINDOWS.md](./SCREENSHOTS_WINDOWS.md). - ## Configuration The screenshot tool is configured via a JSON file located at `tools/screenshot-automation/screenshot-config.json`. This file defines which screenshots to take, their sizes, and other options. diff --git a/docs/SCREENSHOTS_WINDOWS.md b/docs/SCREENSHOTS_WINDOWS.md deleted file mode 100644 index c4e367810..000000000 --- a/docs/SCREENSHOTS_WINDOWS.md +++ /dev/null @@ -1,108 +0,0 @@ -# Running Screenshot Tool on Windows - -This document explains how to use the screenshot automation tool on Windows systems. - -## Prerequisites - -1. Make sure you have Node.js and npm installed -2. PowerShell 5.0 or higher -3. All project dependencies installed (`npm install` in both root and frontend directories) - -## Running the Screenshot Tool - -The easiest way to run the screenshot tool on Windows is to use the provided npm script: - -```powershell -npm run screenshots:win -``` - -This will: -1. Kill any existing servers on the required ports -2. Start the mock data server -3. Start the backend server -4. Start the frontend server -5. Run the screenshot tool with the default configuration -6. Save the screenshots to the `docs/images` directory -7. Clean up all processes when done - -## Troubleshooting - -### PowerShell Execution Policy - -If you get an error about execution policy, you may need to allow script execution: - -```powershell -# Run PowerShell as Administrator and execute: -Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -``` - -### Port Conflicts - -If you get errors about ports already in use: - -1. Make sure no other instances of the application are running -2. Manually kill processes on the required ports: - ```powershell - npx kill-port 7654 7655 3000 - ``` - -### Server Startup Issues - -If any of the servers fail to start: - -1. Check the log files in your temp directory (`%TEMP%\pulse-*.log`) -2. Make sure all dependencies are installed -3. Try running each server manually to see specific error messages - -### Screenshot Tool Issues - -If the screenshot tool fails: - -1. Navigate to the screenshot tool directory: - ```powershell - cd tools\screenshot-automation - ``` - -2. Build the tool: - ```powershell - npm run build - ``` - -3. Run it manually: - ```powershell - npm start -- --config ..\..\screenshot-config.json - ``` - -## Manual Process - -If you prefer to run each step manually: - -1. Start the mock data server: - ```powershell - $env:NODE_ENV = "development" - $env:USE_MOCK_DATA = "true" - $env:MOCK_DATA_ENABLED = "true" - npx ts-node src/mock/run-server.ts - ``` - -2. In another terminal, start the backend server: - ```powershell - $env:USE_MOCK_DATA = "true" - $env:MOCK_DATA_ENABLED = "true" - npm run dev:server - ``` - -3. In another terminal, start the frontend server: - ```powershell - $env:USE_MOCK_DATA = "true" - $env:MOCK_DATA_ENABLED = "true" - cd frontend - npm run dev -- --host "0.0.0.0" --port 3000 - ``` - -4. In another terminal, run the screenshot tool: - ```powershell - cd tools\screenshot-automation - npm run build - npm start -- --config ..\..\screenshot-config.json - ``` \ No newline at end of file diff --git a/package.json b/package.json index b3baa6cf6..e38af4f81 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,7 @@ "dev:frontend": "cd frontend && npm run dev", "dev": "./start-dev.sh", "dev:mock": "./start-mock-dev.sh", - "screenshots": "./scripts/update-screenshots.sh", - "screenshots:win": "powershell -ExecutionPolicy Bypass -File .\\scripts\\update-screenshots.ps1" + "screenshots": "./scripts/update-screenshots.sh" }, "keywords": [ "proxmox", diff --git a/scripts/update-screenshots.ps1 b/scripts/update-screenshots.ps1 deleted file mode 100644 index 46e7148fe..000000000 --- a/scripts/update-screenshots.ps1 +++ /dev/null @@ -1,151 +0,0 @@ -# ProxMox Pulse Screenshot Generator for Windows -# Automates the process of generating screenshots for documentation -# by starting required servers with mock data and running the screenshot tool. - -# Get the project root directory -$ProjectRoot = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path) - -# Process tracking variables -$MockServerProcess = $null -$BackendProcess = $null -$FrontendProcess = $null - -# Cleanup function to ensure all processes are stopped -function Cleanup { - Write-Host "๐Ÿงน Cleaning up processes..." - - if ($FrontendProcess -ne $null) { - Write-Host "Stopping frontend server..." - Stop-Process -Id $FrontendProcess.Id -Force -ErrorAction SilentlyContinue - } - - if ($BackendProcess -ne $null) { - Write-Host "Stopping backend server..." - Stop-Process -Id $BackendProcess.Id -Force -ErrorAction SilentlyContinue - } - - if ($MockServerProcess -ne $null) { - Write-Host "Stopping mock server..." - Stop-Process -Id $MockServerProcess.Id -Force -ErrorAction SilentlyContinue - } - - Write-Host "Killing any remaining processes..." - # Kill any processes that might be using the ports - npx kill-port 7654 7655 3000 -ErrorAction SilentlyContinue -} - -# Set up cleanup trap -try { - # Ensure clean environment - Write-Host "๐Ÿ”ช Killing any existing servers..." - npx kill-port 7654 7655 3000 -ErrorAction SilentlyContinue - - # Start required services - Write-Host "๐Ÿš€ Starting mock data server..." - $env:NODE_ENV = "development" - $env:USE_MOCK_DATA = "true" - $env:MOCK_DATA_ENABLED = "true" - - # Start the mock server - $MockServerProcess = Start-Process -FilePath "npx" -ArgumentList "ts-node", "src/mock/run-server.ts" -WorkingDirectory $ProjectRoot -PassThru -NoNewWindow -RedirectStandardOutput "$env:TEMP\pulse-mock-server.log" -RedirectStandardError "$env:TEMP\pulse-mock-server-error.log" - Write-Host "Mock server started with PID: $($MockServerProcess.Id)" - Start-Sleep -Seconds 5 - - # Check if mock server is running - if ($MockServerProcess.HasExited) { - Write-Host "โŒ Error: Mock data server failed to start" - Get-Content "$env:TEMP\pulse-mock-server.log" - Get-Content "$env:TEMP\pulse-mock-server-error.log" - exit 1 - } - - Write-Host "๐Ÿš€ Starting backend server..." - $env:USE_MOCK_DATA = "true" - $env:MOCK_DATA_ENABLED = "true" - $BackendProcess = Start-Process -FilePath "npx" -ArgumentList "ts-node-dev", "--respawn", "--transpile-only", "src/server.ts" -WorkingDirectory $ProjectRoot -PassThru -NoNewWindow -RedirectStandardOutput "$env:TEMP\pulse-backend.log" -RedirectStandardError "$env:TEMP\pulse-backend-error.log" - Write-Host "Backend server started with PID: $($BackendProcess.Id)" - Start-Sleep -Seconds 8 - - # Check if backend server is running - if ($BackendProcess.HasExited) { - Write-Host "โŒ Error: Backend server failed to start" - Get-Content "$env:TEMP\pulse-backend.log" - Get-Content "$env:TEMP\pulse-backend-error.log" - exit 1 - } - - Write-Host "๐Ÿš€ Starting frontend server..." - $env:USE_MOCK_DATA = "true" - $env:MOCK_DATA_ENABLED = "true" - $FrontendProcess = Start-Process -FilePath "npm" -ArgumentList "run", "dev", "--", "--host", "0.0.0.0", "--port", "3000" -WorkingDirectory "$ProjectRoot\frontend" -PassThru -NoNewWindow -RedirectStandardOutput "$env:TEMP\pulse-frontend.log" -RedirectStandardError "$env:TEMP\pulse-frontend-error.log" - Write-Host "Frontend server started with PID: $($FrontendProcess.Id)" - - # Wait for services to be ready - Write-Host "โณ Waiting for servers to start..." - Start-Sleep -Seconds 15 - - # Verify services are running correctly - try { - $null = Invoke-WebRequest -Uri "http://localhost:3000" -UseBasicParsing -TimeoutSec 5 - } catch { - Write-Host "โŒ Error: Frontend server is not running on port 3000" - Get-Content "$env:TEMP\pulse-frontend.log" - Get-Content "$env:TEMP\pulse-frontend-error.log" - Cleanup - exit 1 - } - - # Check if mock data server is responding - try { - $null = Invoke-WebRequest -Uri "http://localhost:7655/status" -UseBasicParsing -TimeoutSec 5 - } catch { - Write-Host "โŒ Error: Mock data server is not responding on port 7655" - Get-Content "$env:TEMP\pulse-mock-server.log" - Get-Content "$env:TEMP\pulse-mock-server-error.log" - Cleanup - exit 1 - } - - # Check if backend is using mock data - try { - $mockStatus = Invoke-WebRequest -Uri "http://localhost:7654/api/status" -UseBasicParsing -TimeoutSec 5 | Select-Object -ExpandProperty Content - if (-not ($mockStatus -match '"mockDataEnabled":true')) { - Write-Host "โŒ Error: Server is running but mock data is not enabled" - Write-Host "Server status: $mockStatus" - Get-Content "$env:TEMP\pulse-backend.log" - Cleanup - exit 1 - } - } catch { - Write-Host "โŒ Error: Backend server is not responding on port 7654" - Get-Content "$env:TEMP\pulse-backend.log" - Get-Content "$env:TEMP\pulse-backend-error.log" - Cleanup - exit 1 - } - - Write-Host "โœ… All servers are running with mock data enabled" - - # Generate screenshots - Write-Host "๐Ÿ“ธ Running screenshot tool..." - Push-Location "$ProjectRoot\tools\screenshot-automation" - npm run build - $screenshotResult = $? - if ($screenshotResult) { - npm start -- --config "..\..\screenshot-config.json" - $screenshotResult = $? - } - Pop-Location - - # Report results - if ($screenshotResult) { - Write-Host "โœ… Screenshots updated successfully!" - Write-Host "Check the docs/images directory for the new screenshots." - } else { - Write-Host "โŒ Error: Failed to update screenshots" - exit 1 - } -} finally { - # Always run cleanup - Cleanup -} \ No newline at end of file