Route build outputs to dist/ and commit release artifacts
build.ps1 now always packages the .vsix and writes both artifacts to dist/. Added .vscodeignore so the .vsix excludes Go source, TS source, and other dev-only files. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -93,7 +93,6 @@ out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
|
||||
11
.vscodeignore
Normal file
11
.vscodeignore
Normal file
@@ -0,0 +1,11 @@
|
||||
.git/**
|
||||
.vscode/**
|
||||
.gitignore
|
||||
standalone/**
|
||||
dist/**
|
||||
src/**
|
||||
out/**/*.map
|
||||
build.ps1
|
||||
tsconfig.json
|
||||
**/*.vsix
|
||||
node_modules/.cache/**
|
||||
69
build.ps1
69
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
|
||||
|
||||
BIN
hpl-toolbox-0.1.2.vsix → dist/hpl-toolbox-0.1.2.vsix
vendored
BIN
hpl-toolbox-0.1.2.vsix → dist/hpl-toolbox-0.1.2.vsix
vendored
Binary file not shown.
BIN
dist/hpl-toolbox.exe
vendored
Normal file
BIN
dist/hpl-toolbox.exe
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user