Remove Windows screenshot functionality

This commit is contained in:
courtmanr@gmail.com
2025-03-09 18:59:59 +00:00
parent 527d852b8e
commit 3c92f2e530
5 changed files with 2 additions and 268 deletions
-1
View File
@@ -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
+1 -6
View File
@@ -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.
-108
View File
@@ -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
```
+1 -2
View File
@@ -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",
-151
View File
@@ -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
}