diff options
Diffstat (limited to 'bootstrap-win/neovim.ps1')
| -rw-r--r-- | bootstrap-win/neovim.ps1 | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/bootstrap-win/neovim.ps1 b/bootstrap-win/neovim.ps1 index 0e7016e..a20f291 100644 --- a/bootstrap-win/neovim.ps1 +++ b/bootstrap-win/neovim.ps1 | |||
| @@ -103,9 +103,28 @@ function Install-WingetPackage([string]$Binary, [string]$Id) { | |||
| 103 | Write-Ok $Id | 103 | Write-Ok $Id |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | function Install-NpmPackage([string]$Binary, [string]$Package) { | 106 | function Test-BinaryRuns([string]$Binary, [string[]]$VerifyArgs) { |
| 107 | # Einige npm-Pakete (z.B. tree-sitter-cli) installieren nur einen JS-Shim | ||
| 108 | # und laden die eigentliche native Binary per Post-Install-Skript separat | ||
| 109 | # von GitHub herunter. Schlaegt dieser Download fehl (Proxy, ignore-scripts, | ||
| 110 | # Antivirus-Quarantaene), landet der Shim trotzdem im PATH und | ||
| 111 | # Test-CommandExists meldet faelschlich Erfolg. Deshalb hier tatsaechlich | ||
| 112 | # ausfuehren statt nur pruefen, ob der Befehlsname aufloesbar ist. | ||
| 113 | try { | ||
| 114 | & $Binary @VerifyArgs *> $null | ||
| 115 | return $LASTEXITCODE -eq 0 | ||
| 116 | } catch { | ||
| 117 | return $false | ||
| 118 | } | ||
| 119 | } | ||
| 120 | |||
| 121 | function Install-NpmPackage([string]$Binary, [string]$Package, [string[]]$VerifyArgs = $null) { | ||
| 107 | if (Test-CommandExists $Binary) { | 122 | if (Test-CommandExists $Binary) { |
| 108 | Write-Skip $Binary | 123 | if ($VerifyArgs -and -not (Test-BinaryRuns $Binary $VerifyArgs)) { |
| 124 | Write-Warn "'$Binary' ist im PATH, laesst sich aber nicht ausfuehren - vermutlich hat der Post-Install-Download von '$Package' nicht geklappt (Proxy/ignore-scripts pruefen). 'npm uninstall -g $Package' und neu installieren." | ||
| 125 | } else { | ||
| 126 | Write-Skip $Binary | ||
| 127 | } | ||
| 109 | return | 128 | return |
| 110 | } | 129 | } |
| 111 | 130 | ||
| @@ -122,6 +141,11 @@ function Install-NpmPackage([string]$Binary, [string]$Package) { | |||
| 122 | return | 141 | return |
| 123 | } | 142 | } |
| 124 | 143 | ||
| 144 | if ($VerifyArgs -and -not (Test-BinaryRuns $Binary $VerifyArgs)) { | ||
| 145 | Write-Warn "npm install -g $Package war erfolgreich, aber '$Binary' laesst sich nicht ausfuehren - vermutlich hat der Post-Install-Download der nativen Binary nicht geklappt (Proxy/ignore-scripts pruefen)." | ||
| 146 | return | ||
| 147 | } | ||
| 148 | |||
| 125 | Write-Ok $Package | 149 | Write-Ok $Package |
| 126 | } | 150 | } |
| 127 | 151 | ||
| @@ -158,7 +182,7 @@ function Install-Formatters { | |||
| 158 | function Install-Tools { | 182 | function Install-Tools { |
| 159 | Install-WingetPackage -Binary "rg" -Id "BurntSushi.ripgrep.MSVC" | 183 | Install-WingetPackage -Binary "rg" -Id "BurntSushi.ripgrep.MSVC" |
| 160 | Install-WingetPackage -Binary "fd" -Id "sharkdp.fd" | 184 | Install-WingetPackage -Binary "fd" -Id "sharkdp.fd" |
| 161 | Install-NpmPackage -Binary "tree-sitter" -Package "tree-sitter-cli" | 185 | Install-NpmPackage -Binary "tree-sitter" -Package "tree-sitter-cli" -VerifyArgs @("--version") |
| 162 | 186 | ||
| 163 | # MSVC (cl.exe) ist bereits vorhanden, kein winget-Paket noetig - Neovim | 187 | # MSVC (cl.exe) ist bereits vorhanden, kein winget-Paket noetig - Neovim |
| 164 | # dafuer aber aus einer "Developer PowerShell for VS" starten. | 188 | # dafuer aber aus einer "Developer PowerShell for VS" starten. |
