Skip to content

Add PSResourceGet provider to replace deprecated PowerShellGet support#143

Open
AdeeelAsif wants to merge 3 commits into
PowerShellOrg:masterfrom
AdeeelAsif:master
Open

Add PSResourceGet provider to replace deprecated PowerShellGet support#143
AdeeelAsif wants to merge 3 commits into
PowerShellOrg:masterfrom
AdeeelAsif:master

Conversation

@AdeeelAsif
Copy link
Copy Markdown

Context

PowerShellGet is deprecated by Microsoft, PSResourceGet is the supported replacement and provides a modern, unified API for managing PowerShell modules and other resources.

What’s in this PR

  • Added a new PsResourceGet provider based on PsGalleryModule.ps1
  • The new provider uses PSResourceGet cmdlets:
    • Find-PSResource
    • Install-PSResource
    • Save-PSResource

Why this approach

The goal was to keep the integration simple and non-invasive by:

  • Reusing the existing provider structure
  • Adapting only the PowerShellGet-specific commands to PSResourceGet
  • Avoiding changes to the PsDepend dependency model

This allows PsDepend users to adopt PSResourceGet without breaking existing
workflows.

Notes

This PR does not remove or modify the existing PowerShellGet provider.
It only adds an alternative provider for environments where PSResourceGet is preferred or required.
I’d be happy to adjust naming, behavior, or documentation if needed.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an alternative PSDepend provider that installs PowerShell modules/resources via PSResourceGet (intended as a replacement option for deprecated PowerShellGet-based flows), and registers it in the default dependency type map.

Changes:

  • Added a new provider script PSResourceGet.ps1 that uses Find-PSResource, Install-PSResource, and Save-PSResource.
  • Registered the new provider in PSDependMap.psd1 (plus formatting alignment updates).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
PSDepend/PSDependScripts/PSResourceGet.ps1 New PSResourceGet-backed provider implementation (install/save + version checking + optional import flow).
PSDepend/PSDependMap.psd1 Registers the new provider type and reformats map entries for alignment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +228 to +234
$availableParameters = (Get-Command "Install-Module").Parameters
$tempParams = $Params.Clone()
foreach($thisParameter in $Params.Keys)
{
if(-Not ($availableParameters.ContainsKey($thisParameter)))
{
Write-Verbose -Message "Removing parameter [$thisParameter] from [Install-Module] as it is not available"
{
Write-Verbose "Installing [$Name] with scope [$Scope]"
Write-verbose "$params"
Install-PSResource @params
Defaults to PSGallery.

.PARAMETER NoClobber
Allow installation of modules that overwrite existing commands.
Comment on lines +85 to +91
SkipPublisherCheck = $true
}
}
}

# Install the latest BuildHelpers module from a custom registered repository
# and bypass the catalog signing check.
Comment thread PSDepend/PSDependMap.psd1
Comment on lines +87 to +91
PsResourceGet = @{
Script = 'PSResourceGet.ps1'
Description = 'Installs a PowerShell resource from a PowerShell repository using PSResourceGet'
Supports = 'windows', 'core', 'macos', 'linux'
}
Comment thread PSDepend/PSDependMap.psd1
Comment on lines +87 to +91
PsResourceGet = @{
Script = 'PSResourceGet.ps1'
Description = 'Installs a PowerShell resource from a PowerShell repository using PSResourceGet'
Supports = 'windows', 'core', 'macos', 'linux'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants