您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

37 行
988B

  1. $ErrorActionPreference = 'Stop'
  2. $projectRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
  3. $envFile = Join-Path $projectRoot '.env.local'
  4. $distDir = Join-Path $projectRoot 'dist'
  5. $outFile = Join-Path $distDir 'qctextbuilder.exe'
  6. if (-not (Test-Path $envFile)) {
  7. throw "Missing .env.local at $envFile"
  8. }
  9. Get-Content $envFile | ForEach-Object {
  10. $line = $_.Trim()
  11. if (-not $line -or $line.StartsWith('#')) { return }
  12. $parts = $line -split '=', 2
  13. if ($parts.Count -ne 2) { return }
  14. $name = $parts[0].Trim()
  15. $value = $parts[1]
  16. [System.Environment]::SetEnvironmentVariable($name, $value, 'Process')
  17. }
  18. if (-not (Test-Path $distDir)) {
  19. New-Item -ItemType Directory -Path $distDir | Out-Null
  20. }
  21. Set-Location $projectRoot
  22. Write-Host 'Running go test ./...' -ForegroundColor Cyan
  23. go test ./...
  24. Write-Host "Building $outFile" -ForegroundColor Green
  25. go build -o $outFile ./cmd/qctextbuilder
  26. Write-Host "Build complete: $outFile" -ForegroundColor Green