41 lines
1.0 KiB
PowerShell
41 lines
1.0 KiB
PowerShell
param(
|
|
[switch]$OpenBrowser
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$scriptRoot = [System.IO.Path]::GetFullPath($PSScriptRoot)
|
|
$projectRoot = Split-Path -Parent $scriptRoot
|
|
|
|
$packagedExecutable = Join-Path $scriptRoot 'task-pilot-backend.exe'
|
|
if (Test-Path -LiteralPath $packagedExecutable) {
|
|
$executable = $packagedExecutable
|
|
$workingDirectory = $scriptRoot
|
|
$staticDirectory = Join-Path $scriptRoot 'web'
|
|
}
|
|
else {
|
|
$executable = Join-Path $projectRoot 'backend\target\release\task-pilot-backend.exe'
|
|
$workingDirectory = $projectRoot
|
|
$staticDirectory = Join-Path $projectRoot 'frontend\dist'
|
|
if (-not (Test-Path -LiteralPath $executable)) {
|
|
throw 'Release executable not found. Run .\scripts\build-release.ps1 first.'
|
|
}
|
|
}
|
|
|
|
$env:TASK_PILOT_STATIC_DIR = $staticDirectory
|
|
$address = 'http://127.0.0.1:3000'
|
|
|
|
Write-Host "TaskPilot: $address"
|
|
Write-Host "Static assets: $staticDirectory"
|
|
|
|
if ($OpenBrowser) {
|
|
Start-Process $address
|
|
}
|
|
|
|
Push-Location $workingDirectory
|
|
try {
|
|
& $executable
|
|
}
|
|
finally {
|
|
Pop-Location
|
|
}
|