-
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathrun.ps1
More file actions
73 lines (67 loc) · 2.63 KB
/
run.ps1
File metadata and controls
73 lines (67 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Use automatic $args instead of param binding
$cmd = $args
function Start-ForkedProcess {
param($command, $directory)
$processInfo = New-Object System.Diagnostics.ProcessStartInfo
$processInfo.FileName = "cmd.exe"
$processInfo.Arguments = "/c $command"
if ($directory) { $processInfo.WorkingDirectory = $directory }
$processInfo.UseShellExecute = $true
[System.Diagnostics.Process]::Start($processInfo) | Out-Null
}
if (-not $cmd -or $cmd.Count -eq 0) {
npm run start
return
}
for ($i = 0; $i -lt $cmd.Count; $i++) {
$action = $cmd[$i]
Write-Output "Executing command: $action"
switch ($action) {
"sync" {
Write-Host "Syncing environment..." -ForegroundColor Cyan
uv sync --locked --no-dev
~\AppData\Roaming\GameSentenceMiner\python_venv\Scripts\python.exe -m uv sync --active --locked --no-dev --no-install-project --inexact --project .
}
"gsm" {
Write-Host "Forking Main App..." -ForegroundColor Green
Start-ForkedProcess -command "npm run start"
}
"overlay" {
Write-Host "Forking Overlay..." -ForegroundColor Magenta
Start-ForkedProcess -command "npm run start" -directory "./GSM_Overlay"
}
"add" {
if ($i + 1 -lt $cmd.Count) {
$package = $cmd[$i + 1]
Write-Host "Adding package: $package" -ForegroundColor Yellow
uv add "$package"
Write-Host "Lockfiles are generated in CI. Run uv lock locally only if you need to test lock changes." -ForegroundColor DarkYellow
$i++
} else {
Write-Error "Usage: add <package>"
}
}
"manifest" {
Write-Host "Generating runtime lock manifest..." -ForegroundColor Cyan
python scripts/generate_runtime_lock_manifest.py --lock uv.lock --pyproject pyproject.toml --output runtime-lock-manifest.json --uv-version 0.9.22
}
"concat" {
Write-Host "Concatenating files..." -ForegroundColor Blue
python (Join-Path $PSScriptRoot "concat_proj.py") --include "*.py" "*.ts"
}
"test" {
Write-Host "Running full pytest suite..." -ForegroundColor Cyan
if (Test-Path ".\.venv\Scripts\python.exe") {
& ".\.venv\Scripts\python.exe" -m pytest
} else {
python -m pytest
}
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
}
default {
Write-Host "Unknown command: $action" -ForegroundColor Red
}
}
}