# build\tools\generate-dotenv.ps1 # Repository root: go up two levels from build\tools\ $repoRoot = (Get-Item $PSScriptRoot).Parent.Parent.FullName $envPath = Join-Path $repoRoot ".env" $pomPath = Join-Path $repoRoot "pom.xml" if (-not (Test-Path $pomPath -PathType Leaf)) { throw "pom.xml not found: $pomPath" } [xml]$pom = Get-Content $pomPath -Encoding UTF8 $version = $pom.project.version $lines = @( "# Auto-generated by build\tools\generate-dotenv.ps1" "SNOW_VERSION=$version" ) $utf8NoBom = New-Object System.Text.UTF8Encoding($false) [System.IO.File]::WriteAllLines($envPath, $lines, $utf8NoBom) Write-Host "Generated/overwritten $envPath (version: $version)" return