diff --git a/.gitignore b/.gitignore index 3224a90..90e0b96 100644 --- a/.gitignore +++ b/.gitignore @@ -93,7 +93,6 @@ out # Nuxt.js build / generate output .nuxt -dist # Gatsby files .cache/ diff --git a/.vscodeignore b/.vscodeignore new file mode 100644 index 0000000..ab6dbec --- /dev/null +++ b/.vscodeignore @@ -0,0 +1,11 @@ +.git/** +.vscode/** +.gitignore +standalone/** +dist/** +src/** +out/**/*.map +build.ps1 +tsconfig.json +**/*.vsix +node_modules/.cache/** diff --git a/build.ps1 b/build.ps1 index 1f50c84..548ea4e 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,22 +1,15 @@ <# .SYNOPSIS - Builds both the VSCode extension and the standalone Windows exe. - -.DESCRIPTION - - Extension: tsc compile -> out/extension.js - - Standalone: go build -> standalone/hpl-toolbox.exe (single static binary) - - Optionally packages the extension as a .vsix with -Package. + Builds both the VSCode extension (.vsix) and the standalone Windows exe. + Both artifacts land in dist/. .EXAMPLE .\build.ps1 - .\build.ps1 -Package .\build.ps1 -Standalone # Skip the extension; build only the exe - .\build.ps1 -Extension # Skip the standalone; build only the extension + .\build.ps1 -Extension # Skip the standalone; build only the .vsix #> [CmdletBinding()] param( - [switch]$Package, [switch]$Extension, [switch]$Standalone ) @@ -31,6 +24,9 @@ if (-not $Extension -and -not $Standalone) { $Standalone = $true } +$distDir = Join-Path $repoRoot "dist" +New-Item -ItemType Directory -Path $distDir -Force | Out-Null + function Write-Step($msg) { Write-Host "" Write-Host "==> $msg" -ForegroundColor Cyan @@ -58,10 +54,10 @@ if (-not (Get-Command go -ErrorAction SilentlyContinue)) { $summary = @() # ---------------------------------------------------------------------- -# VSCode extension +# VSCode extension -> .vsix # ---------------------------------------------------------------------- if ($Extension) { - Write-Step "Building VSCode extension (tsc)" + Write-Step "Building VSCode extension" if (-not (Test-Path "node_modules")) { Write-Host " node_modules missing - running npm install" -ForegroundColor Yellow npm install @@ -69,36 +65,32 @@ if ($Extension) { } npm run compile if ($LASTEXITCODE -ne 0) { Write-Error "tsc compile failed"; exit 1 } - $extOut = Join-Path $repoRoot "out\extension.js" - $summary += [pscustomobject]@{ - Artifact = "Extension (out/extension.js)" - Size = Get-FileSize $extOut - } - if ($Package) { - Write-Step "Packaging .vsix" - if (-not (Get-Command vsce -ErrorAction SilentlyContinue)) { - Write-Host " vsce not found - installing via npx (one-time)" -ForegroundColor Yellow - npx --yes @vscode/vsce package - } else { - vsce package - } - if ($LASTEXITCODE -ne 0) { Write-Error "vsce package failed"; exit 1 } - $vsix = Get-ChildItem -Path $repoRoot -Filter "*.vsix" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 - if ($vsix) { - $summary += [pscustomobject]@{ - Artifact = "Extension ($($vsix.Name))" - Size = Get-FileSize $vsix.FullName - } + Write-Step "Packaging .vsix -> dist/" + $vsixTargetDir = $distDir + if (Get-Command vsce -ErrorAction SilentlyContinue) { + vsce package --out $vsixTargetDir + } else { + Write-Host " vsce not found - using npx @vscode/vsce" -ForegroundColor Yellow + npx --yes @vscode/vsce package --out $vsixTargetDir + } + if ($LASTEXITCODE -ne 0) { Write-Error "vsce package failed"; exit 1 } + + $vsix = Get-ChildItem -Path $distDir -Filter "*.vsix" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 + if ($vsix) { + $summary += [pscustomobject]@{ + Artifact = $vsix.Name + Path = "dist\$($vsix.Name)" + Size = Get-FileSize $vsix.FullName } } } # ---------------------------------------------------------------------- -# Standalone Windows exe +# Standalone Windows exe -> dist/hpl-toolbox.exe # ---------------------------------------------------------------------- if ($Standalone) { - Write-Step "Building standalone exe (go build)" + Write-Step "Building standalone exe -> dist/" Push-Location (Join-Path $repoRoot "standalone") try { # If rsrc.syso is missing (e.g. fresh clone before icon embedding), regenerate. @@ -112,13 +104,14 @@ if ($Standalone) { } } - go build -ldflags="-s -w -H windowsgui" -trimpath -o hpl-toolbox.exe . + $exeOut = Join-Path $distDir "hpl-toolbox.exe" + go build -ldflags="-s -w -H windowsgui" -trimpath -o $exeOut . if ($LASTEXITCODE -ne 0) { Write-Error "go build failed"; exit 1 } - $exePath = Join-Path (Get-Location) "hpl-toolbox.exe" $summary += [pscustomobject]@{ - Artifact = "Standalone (standalone/hpl-toolbox.exe)" - Size = Get-FileSize $exePath + Artifact = "hpl-toolbox.exe" + Path = "dist\hpl-toolbox.exe" + Size = Get-FileSize $exeOut } } finally { Pop-Location diff --git a/hpl-toolbox-0.1.2.vsix b/dist/hpl-toolbox-0.1.2.vsix similarity index 58% rename from hpl-toolbox-0.1.2.vsix rename to dist/hpl-toolbox-0.1.2.vsix index d7a425d..8c69ed0 100644 Binary files a/hpl-toolbox-0.1.2.vsix and b/dist/hpl-toolbox-0.1.2.vsix differ diff --git a/dist/hpl-toolbox.exe b/dist/hpl-toolbox.exe new file mode 100644 index 0000000..71bb2e4 Binary files /dev/null and b/dist/hpl-toolbox.exe differ