From b0912a68f5ccf5208849a5fca5e14b93cf14c13d Mon Sep 17 00:00:00 2001 From: Stephan Yelle Date: Sat, 28 Jun 2025 20:47:08 -0400 Subject: [PATCH] test hide nuget table --- StackMonkey.ps1 | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/StackMonkey.ps1 b/StackMonkey.ps1 index 993b243..acd3f11 100644 --- a/StackMonkey.ps1 +++ b/StackMonkey.ps1 @@ -94,8 +94,8 @@ #region — guarantee NuGet provider is present without prompting # ─── Top of script ─── -Import-Module PackageManagement -Force -ErrorAction SilentlyContinue -Import-Module PowerShellGet -Force -ErrorAction SilentlyContinue +Import-Module PackageManagement -Force -ErrorAction SilentlyContinue | Out-Null +Import-Module PowerShellGet -Force -ErrorAction SilentlyContinue | Out-Null # ─── ensure TLS 1.2 + no prompts ─── [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 @@ -107,29 +107,38 @@ $nuget = Get-PackageProvider -Name NuGet -ListAvailable -ErrorAction SilentlyCon if (-not $nuget) { # install it (again, assignment suppresses the table) - $nuget = Install-PackageProvider ` + Install-PackageProvider ` -Name NuGet ` -MinimumVersion 2.8.5.201 ` -Force ` -Confirm:$false - Write-Host "✔ Installed NuGet provider v$($nuget.Version)" -ForegroundColor Green + + # re-query just for version info + $found = Get-PackageProvider -Name NuGet -ListAvailable + Write-Host "Installed NuGet provider v$($found.Version)" -ForegroundColor Green } else { - Write-Host "ℹ NuGet provider already present (v$($nuget.Version))" -ForegroundColor DarkGray + Write-Host "NuGet provider already present (v$($found.Version))" -ForegroundColor DarkGray } -# import it so Register-PSRepository / Install-Module won't prompt -Import-PackageProvider -Name NuGet -Force -ErrorAction SilentlyContinue +# now import it silently +Import-PackageProvider -Name NuGet -Force -ErrorAction SilentlyContinue | Out-Null -# ensure PSGallery is trusted (so you don't get “untrusted repository” prompt -if ((Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue).InstallationPolicy -ne 'Trusted') { - Set-PSRepository ` - -Name PSGallery ` - -InstallationPolicy Trusted ` - -ErrorAction SilentlyContinue +# ensure trust PSGallery without its own output (so you don't get “untrusted repository” prompt +$gallery = Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue +if ($gallery.InstallationPolicy -ne 'Trusted') { + Set-PSRepository ` + -Name PSGallery ` + -InstallationPolicy Trusted ` + -ErrorAction SilentlyContinue | Out-Null + + Write-Host "PSGallery marked as Trusted" -ForegroundColor Green } +# …and only *after* this completes* do you Start-Server… +Write-Host "Starting ScriptMonkey UI on http://localhost:$Port/" -ForegroundColor Cyan + #endregion