-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.ps1
More file actions
73 lines (61 loc) · 2.85 KB
/
Copy pathbootstrap.ps1
File metadata and controls
73 lines (61 loc) · 2.85 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
<#
.SYNOPSIS
One-time dev setup for Vacation Recap (native Windows).
.DESCRIPTION
Verifies the two required global tools (uv + fnm) are installed, then:
- installs Python 3.13 + Python deps into .venv via `uv sync`
- installs Node (per .node-version) via fnm and frontend npm deps
- downloads the vendor ffprobe.exe and ExifTool into vendor\
uv and fnm are single self-contained binaries; everything they install
lives in their own per-user dirs (purgeable) plus this repo's .venv,
frontend\node_modules, and vendor\ (all gitignored). WebView2 ships with
Windows 11, so there is nothing else to install.
Run once after cloning. For the day-to-day dev loop use dev.ps1.
#>
$ErrorActionPreference = "Stop"
$repo = $PSScriptRoot
Set-Location $repo
function Require-Tool($name, $installHint) {
if (-not (Get-Command $name -ErrorAction SilentlyContinue)) {
Write-Host "ERROR: '$name' is not installed or not on PATH." -ForegroundColor Red
Write-Host " Install it, then re-run .\bootstrap.ps1:" -ForegroundColor Yellow
Write-Host " $installHint" -ForegroundColor Yellow
exit 1
}
}
Write-Host "==> Checking required tools (uv, fnm)..." -ForegroundColor Cyan
Require-Tool "uv" 'powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"'
Require-Tool "fnm" 'winget install Schniz.fnm'
Write-Host "==> Installing Python + dependencies (uv sync)..." -ForegroundColor Cyan
uv sync --extra dev
if ($LASTEXITCODE -ne 0) { throw "uv sync failed" }
# Windows: asyncio SelectorEventLoop has a 512-FD select() limit that breaks
# uvicorn's --reload worker. sitecustomize.py runs at Python startup (before
# any event loop is created) in every subprocess, including the reload worker.
$siteCustomize = Join-Path $repo ".venv\Lib\site-packages\sitecustomize.py"
Set-Content -Path $siteCustomize -Encoding utf8 -Value @'
import sys
if sys.platform == "win32":
import asyncio
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
'@
Write-Host "==> Installing Node (fnm) + frontend dependencies..." -ForegroundColor Cyan
# Bring fnm-managed Node onto PATH for this session, then install the
# version pinned in .node-version.
fnm env --shell powershell | Out-String | Invoke-Expression
fnm use --install-if-missing
if ($LASTEXITCODE -ne 0) { throw "fnm use failed" }
Push-Location frontend
try {
npm install
if ($LASTEXITCODE -ne 0) { throw "npm install failed" }
} finally {
Pop-Location
}
Write-Host "==> Fetching vendor binaries (ffprobe, ExifTool)..." -ForegroundColor Cyan
uv run python build/vendor_ffprobe.py
if ($LASTEXITCODE -ne 0) { throw "vendor_ffprobe.py failed" }
uv run python build/vendor_exiftool.py
if ($LASTEXITCODE -ne 0) { throw "vendor_exiftool.py failed" }
Write-Host ""
Write-Host "Setup complete. Start the app with: .\dev.ps1" -ForegroundColor Green