feat: add native Windows local orchestration
This commit is contained in:
26
scripts/local-dev.ps1
Normal file
26
scripts/local-dev.ps1
Normal file
@@ -0,0 +1,26 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Position = 0)][ValidateSet('check', 'start', 'stop', 'status')][string]$Action = 'status',
|
||||
[string]$BackendPath,
|
||||
[string]$FrontendPath
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$deploymentPath = Split-Path $PSScriptRoot -Parent
|
||||
if (-not $BackendPath) { $BackendPath = Join-Path (Split-Path $deploymentPath -Parent) 'zarinpal-analytics-backend' }
|
||||
if (-not $FrontendPath) { $FrontendPath = Join-Path (Split-Path $deploymentPath -Parent) 'zarinpal-analytics-frontend' }
|
||||
|
||||
Import-Module (Join-Path $PSScriptRoot 'LocalDev.psm1') -Force
|
||||
|
||||
try {
|
||||
switch ($Action) {
|
||||
'check' { Invoke-LocalDevCheck -DeploymentPath $deploymentPath -BackendPath $BackendPath -FrontendPath $FrontendPath | Format-List }
|
||||
'start' { Start-LocalDev -DeploymentPath $deploymentPath -BackendPath $BackendPath -FrontendPath $FrontendPath | Format-Table -AutoSize }
|
||||
'stop' { Stop-LocalDev -DeploymentPath $deploymentPath; Write-Output 'Local services stopped.' }
|
||||
'status' { Get-LocalDevStatus -DeploymentPath $deploymentPath | Format-Table -AutoSize }
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Error $_
|
||||
exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user