Added NPX Fix for Deployment Edge Cases

This commit is contained in:
Nicole Rappe 2025-04-15 17:37:54 -06:00
parent a9246cce45
commit 17e0d20063

View File

@ -87,12 +87,10 @@ switch ($choice) {
# ---------------------- Server: Create Python Virtual Environment & Prepare Files ----------------------
Run-Step "Create Borealis Virtual Python Environment" {
# Create virtual environment if it does not exist
Write-Host "Create virtual environment if it does not exist"
if (!(Test-Path "$venvFolder\Scripts\Activate")) {
python -m venv $venvFolder | Out-Null
}
# Copy server data if the Data folder exists
Write-Host "Copy server data if the Data folder exists"
if (Test-Path $dataSource) {
if (Test-Path $dataDestination) {
Remove-Item -Recurse -Force $dataDestination | Out-Null
@ -103,24 +101,20 @@ switch ($choice) {
Write-Host "`r$($symbols.Info) Warning: Data folder not found, skipping copy." -ForegroundColor Yellow
}
# React UI Deployment: Create default React app if no deployment folder exists
Write-Host "React UI Deployment: Create default React app if no deployment folder exists"
if (-not (Test-Path $webUIDestination)) {
npx create-react-app $webUIDestination | Out-Null
npx --yes create-react-app "$webUIDestination" --verbose | Out-Null
}
# Copy custom UI if it exists
Write-Host "Copy custom UI if it exists"
if (Test-Path $customUIPath) {
Copy-Item -Path "$customUIPath\*" -Destination $webUIDestination -Recurse -Force
} else {
Write-Host "`r$($symbols.Info) No custom UI found, using default React app." -ForegroundColor Yellow
}
# Remove any existing React build folders
Write-Host "Remove any existing React build folders"
if (Test-Path "$webUIDestination\build") {
Remove-Item -Path "$webUIDestination\build" -Recurse -Force
}
# Activate the Python virtual environment
Write-Host "Activate the Python virtual environment"
. "$venvFolder\Scripts\Activate"
}