mirror of
https://github.com/trycua/lume.git
synced 2026-01-06 04:20:03 -06:00
Fix yargs --version implementation printing "unknown" for built .exe's
This commit is contained in:
@@ -32,11 +32,29 @@ function Install-WithBun {
|
||||
|
||||
try {
|
||||
bun add -g @trycua/cli
|
||||
# Determine installed version from npm registry
|
||||
try {
|
||||
$bunVersion = (npm view @trycua/cli version) 2>$null
|
||||
if (-not $bunVersion) { $bunVersion = "unknown" }
|
||||
} catch { $bunVersion = "unknown" }
|
||||
# Ensure install dir and write version file
|
||||
$installDir = "$env:USERPROFILE\.cua\bin"
|
||||
if (-not (Test-Path $installDir)) { New-Item -ItemType Directory -Path $installDir -Force | Out-Null }
|
||||
Set-Content -Path (Join-Path $installDir ".version") -Value $bunVersion -NoNewline
|
||||
return $true
|
||||
} catch {
|
||||
Write-Host "Warning: Failed to install with Bun, trying npm..." -ForegroundColor Yellow
|
||||
try {
|
||||
npm install -g @trycua/cli
|
||||
# Determine installed version from npm registry
|
||||
try {
|
||||
$npmVersion = (npm view @trycua/cli version) 2>$null
|
||||
if (-not $npmVersion) { $npmVersion = "unknown" }
|
||||
} catch { $npmVersion = "unknown" }
|
||||
# Ensure install dir and write version file
|
||||
$installDir = "$env:USERPROFILE\.cua\bin"
|
||||
if (-not (Test-Path $installDir)) { New-Item -ItemType Directory -Path $installDir -Force | Out-Null }
|
||||
Set-Content -Path (Join-Path $installDir ".version") -Value $npmVersion -NoNewline
|
||||
return $true
|
||||
} catch {
|
||||
Write-Host "Error: Installation failed with npm as well." -ForegroundColor Red
|
||||
@@ -106,6 +124,13 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
# Write version file for binary install
|
||||
try {
|
||||
Set-Content -Path (Join-Path $installDir ".version") -Value $version -NoNewline
|
||||
} catch {
|
||||
# Non-fatal
|
||||
}
|
||||
|
||||
# Add to PATH if not already there
|
||||
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
||||
if ($currentPath -notlike "*$installDir*") {
|
||||
|
||||
Reference in New Issue
Block a user