Invoke-PaketForAl.ps1
function Invoke-PaketForAl { param( $Command = 'install', $ProjectPath = (get-location), [switch]$UsePackagesAsCache, [string[]] $Sources ) $PaketPath = 'C:\ProgramData\chocolatey\lib\Paket\tools\' $PaketExe = Join-Path $PaketPath "paket.exe" if (-not (Test-Path $PaketExe)) { $PaketExe = 'paket.exe' $PaketPath = '' } Write-Verbose "Creating/Updating paket.dependencies file..." ConvertTo-PaketDependencies -ProjectPath $ProjectPath -NuGetSources $Sources Write-Verbose "Running paket.exe $Command..." & $PaketExe $Command if ($UsePackagesAsCache) { $SettingsPath = Join-Path $ProjectPath ".vscode/settings.json" if (-not (Test-Path $SettingsPath)) { $Settings = @{ "al.packageCachePath" = @("packages") } } else { $Settings = Get-Content $SettingsPath | ConvertFrom-Json if ( [bool]($Settings.PSobject.Properties.name -match "al.packageCachePath")) { if (-not ($Settings."al.packageCachePath" | where-object { $_ -eq "packages" })) { if ($Settings."al.packageCachePath".Count -gt 0) { $Settings."al.packageCachePath" += "packages" } else { $Settings."al.packageCachePath" = @($Settings["al.packageCachePath"], "packages") } } } else { $Settings | Add-Member -MemberType NoteProperty -Name "al.packageCachePath" -Value @("packages") } } $Settings | ConvertTo-Json | Out-File $SettingsPath } } |