Skip to content

Commit 1eb4d3b

Browse files
updates
1 parent efddbfe commit 1eb4d3b

6 files changed

Lines changed: 123 additions & 5 deletions

File tree

PSFramework.NuGet/PSFramework.NuGet.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
RootModule = 'PSFramework.NuGet.psm1'
44

55
# Version number of this module.
6-
ModuleVersion = '0.9.2'
6+
ModuleVersion = '0.9.11'
77

88
# ID used to uniquely identify this module
99
GUID = 'ad0f2a25-552f-4dd6-bd8e-5ddced2a5d88'

PSFramework.NuGet/changelog.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# Changelog
22

3-
## ???
3+
## 0.9.11 (2025-05-05)
44

5+
+ New: Bootstrap script to deploy PSFramework.NuGet to the local computer without requiring Package Management.
6+
+ New: Module automatically deploys the NuGet provider to the user profile on module import, to simplify the PowerShellGet experience
57
+ Upd: Updated to include PSResourceGet 1.1.0
68
+ Upd: Get-PSFPowerShellGet - improved result display style
9+
+ Fix: Install-PSFModule - fails to detect already existing version of module and attempts to overwrite
710
+ Fix: Install-PSFModule - returns unexpected object when successfully installing, but not from the first priority repository
811
+ Fix: Install-PSFModule - progress bar does not show number of deployments in progress.
12+
+ Fix: Save-PSFModule - fails to detect already existing version of module and attempts to overwrite
913
+ Fix: Scope: AllUsers - fails to install to AllUsers when no module has been installed there yet.
1014

1115
## 0.9.2 (2025-01-17)

PSFramework.NuGet/internal/configurations/configuration.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ Set-PSFConfig -Module 'PSFramework.NuGet' -Name 'Import.IndividualFiles' -Value
1616

1717
Set-PSFConfig -Module 'PSFramework.NuGet' -Name 'Install.AuthenticodeSignature.Check' -Value $false -Initialize -Validation 'bool' -Description 'Whether on installation or download of module its code-signing will be checked first.'
1818
Set-PSFConfig -Module 'PSFramework.NuGet' -Name 'Remoting.DefaultConfiguration' -Value 'Microsoft.PowerShell' -Initialize -Validation string -Description 'The PSSessionConfiguration to use when initializing new PS remoting sessions'
19-
Set-PSFConfig -Module 'PSFramework.NuGet' -Name 'Remoting.Throttling' -Value 5 -Initialize -Validation integerpositive -Description 'Up to how many remote computers to deploy to in parallel.'
19+
Set-PSFConfig -Module 'PSFramework.NuGet' -Name 'Remoting.Throttling' -Value 5 -Initialize -Validation integerpositive -Description 'Up to how many remote computers to deploy to in parallel.'
20+
Set-PSFConfig -Module 'PSFramework.NuGet' -Name 'LocalBootstrap' -Value $true -Initialize -Validation bool -Description 'Whether PSGetV2 gets automatically bootstrapped on module import. This happens by default to improve user experience with an unmodified PowerShell that have never had to deal with PSGet. Also to simplify the experience in an offline environment.'

PSFramework.NuGet/internal/functions/Get/Publish-StagingModuleLocal.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@
5757
$publishCommon.Module = $module.Name
5858
$publishCommon.Version = $version.Name
5959

60-
$testPath = Join-Path -Path $destination.Path -ChildPath "$($module.Name)/$($version.Name)/$($module.DirectoryName).psd1"
60+
$testPath = Join-Path -Path $destination.Path -ChildPath "$($module.Name)/$($version.Name)/$($module.Name).psd1"
6161
$alreadyExists = Test-Path -Path $testPath
6262
if ($alreadyExists -and -not $Force) {
6363
Write-PSFMessage @msgParam -String 'Publish-StagingModule.Skipping.AlreadyExists' -StringValues $module.Name, $version.Name, $destination.Path
64+
New-PublishResult @publishCommon -Success $true -Message 'Module already deployed'
6465
continue
6566
}
6667

PSFramework.NuGet/internal/scripts/initialize.ps1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,15 @@
22
Search-PSFPowerShellGet
33

44
# Ensure all configured repositories exist, and all unintended repositories are gone
5-
Update-PSFRepository
5+
Update-PSFRepository
6+
7+
# Auto-Bootstrap Local GetV2 on Windows
8+
if (
9+
($PSVersionTable.PSVersion.Major -lt 5 -or $IsWindows) -and
10+
$env:LOCALAPPDATA -and
11+
(-not (Test-Path "$env:LOCALAPPDATA\PackageManagement\ProviderAssemblies\nuget\2.8.5.208\Microsoft.PackageManagement.NuGetProvider.dll")) -and
12+
(Get-PSFConfigValue -FullName 'PSFramework.NuGet.LocalBootstrap')
13+
) {
14+
$null = New-Item -Path "$env:LOCALAPPDATA\PackageManagement\ProviderAssemblies\nuget\2.8.5.208" -ItemType Directory -Force -ErrorAction SilentlyContinue
15+
Copy-Item -Path "$script:ModuleRoot\bin\Microsoft.PackageManagement.NuGetProvider.dll" -Destination "$env:LOCALAPPDATA\PackageManagement\ProviderAssemblies\nuget\2.8.5.208" -ErrorAction SilentlyContinue
16+
}

bootstrap.ps1

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<#
2+
.SYNOPSIS
3+
Installs all that is needed to run PSFramework.NuGet without using the PowerShellGet tools.
4+
5+
.DESCRIPTION
6+
Installs all that is needed to run PSFramework.NuGet without using the PowerShellGet tools.
7+
8+
.EXAMPLE
9+
PS C:\> .\bootstrap.ps1
10+
11+
Installs all that is needed to run PSFramework.NuGet without using the PowerShellGet tools.
12+
13+
.EXAMPLE
14+
PS C:\> Iwr https://raw.githubusercontent.com/PowershellFrameworkCollective/PSFramework.NuGet/refs/heads/master/bootstrap.ps1 | iex
15+
16+
This one-liner will download the script into memory and then execute it directly, enabling PowerShell package management on the local computer.
17+
#>
18+
[CmdletBinding()]
19+
param (
20+
21+
)
22+
23+
$ErrorActionPreference = 'Stop'
24+
trap {
25+
Write-Warning "Script failed: $_"
26+
throw $_
27+
}
28+
29+
#region Functions
30+
function Find-GalleryModule {
31+
[CmdletBinding()]
32+
param (
33+
[string[]]
34+
$Name
35+
)
36+
37+
foreach ($moduleName in $Name) {
38+
$page = Invoke-WebRequest "https://www.powershellgallery.com/packages/$moduleName" -UseBasicParsing
39+
$versions = $page.Links | Where-Object href -Match "^/packages/$moduleName/\d+(\.\d+){1,3}$"
40+
foreach ($version in $versions) {
41+
$null = $version.href -match '/(\d+(\.\d+){1,3})$'
42+
Add-Member -InputObject $version -MemberType NoteProperty -Name Version -Value ($matches.1 -as [version]) -Force
43+
}
44+
45+
$latest = $versions | Sort-Object Version -Descending | Select-Object -First 1
46+
47+
[PSCustomObject]@{
48+
Name = $moduleName
49+
Version = $latest.Version
50+
Link = 'https://psg-prod-eastus.azureedge.net/packages/{0}.{1}.nupkg' -f $moduleName.ToLower(), $latest.Version
51+
}
52+
}
53+
}
54+
55+
function Install-GalleryModule {
56+
[CmdletBinding()]
57+
param (
58+
$Module
59+
)
60+
61+
Write-Host "Installing: $($Module.Name) ($($Module.Version))"
62+
63+
trap {
64+
Write-Host " Failed: $_" -ForegroundColor Red -BackgroundColor Black
65+
return
66+
}
67+
68+
# Resolve target path and skip if not needed
69+
$modulePath = $env:PSModulePath -split ';' | Where-Object { $_ -match '\\Documents\\' } | Select-Object -First 1
70+
if (-not $modulePath) { $modulePath = $env:PSModulePath -split ';' | Select-Object -First 1 }
71+
$moduleRoot = Join-Path -Path $modulePath -ChildPath "$($Module.Name)/$($Module.Version)"
72+
if (Test-Path -Path $moduleRoot) {
73+
Write-Host " $($Module.Name) already installed, skipping"
74+
return
75+
}
76+
77+
$ProgressPreference = 'SilentlyContinue'
78+
$staging = New-Item -Path $env:TEMP -Name "PSMS-$(Get-Random)" -ItemType Directory
79+
Invoke-WebRequest -Uri $Module.Link -OutFile "$($staging.FullName)\$($Module.Name).zip" -ErrorAction Stop
80+
Expand-Archive -Path "$($staging.FullName)\$($Module.Name).zip" -DestinationPath $staging.FullName -ErrorAction Stop
81+
82+
# Remove undesired parts
83+
Remove-Item -Path "$($staging.FullName)\$($Module.Name).zip"
84+
Remove-Item -Path "$($staging.FullName)\$($Module.Name).nuspec"
85+
Remove-Item -LiteralPath "$($staging.FullName)\[Content_Types].xml"
86+
Remove-Item -Path "$($staging.FullName)\_rels" -Recurse -Force
87+
Remove-Item -Path "$($staging.FullName)\package" -Recurse -Force
88+
89+
# Deploy to Documents
90+
$null = New-Item -Path $moduleRoot -ItemType Directory -Force
91+
Move-Item -Path "$($staging.FullName)\*" -Destination $moduleRoot -Force -ErrorAction Stop
92+
Write-Host " Successfully completed" -ForegroundColor Green -BackgroundColor Black
93+
94+
Remove-Item -Path $staging -ErrorAction SilentlyContinue -Force -Recurse
95+
}
96+
#endregion Functions
97+
98+
$modules = Find-GalleryModule -Name PSFramework, ConvertToPSD1, PSFramework.NuGet
99+
foreach ($module in $modules) {
100+
Install-GalleryModule -Module $module
101+
}

0 commit comments

Comments
 (0)