PSResourceGet
PSResourceGet copied to clipboard
Publish-Module Violates Single Responsibility Principle
Summary of the new feature / enhancement
As a user, I expect Publish-Module to publish a module, not package AND publish a module. As a user, I also expect that I can issue Package-Module to create a new module package that can then be published to one or more places, such as the PowerShellGallery and/or private package feeds.
Proposed technical implementation details (optional)
For example, the following workflows are what I desire:
PS C:\MyProject> Package-Module -Path ./out/MyModule
ModuleName Version Path
---------- ------- -------------------------
MyModule 1.0.0 C:\MyProject\artifacts\MyModule-1.0.0.nupkg
and then, combined with Publish-Module, perhaps something like:
PS C:\MyProject> Package-Module -Path ./out/MyModule -PassThru | Publish-Module ...
I also have had the same concern for a while. I would have wanted a New-PSResource or Build-PSResource and publish only pushes the resource to the repository.
@SydneyhSmith I know this is close to release but the existing functionality is already there just splitting it into two cmdlets.
We have been wanting to support publishing already built packages (nupkgs), and may need to in order to support certain repositories in the future...this won't block RC but I agree that it would be nice to have a Build-PSResource type command and support either unpacked modules or nupkgs as input for Publish-PSResource, probably as different parameter sets
Today you can sort of accomplish this by using the -DestinationPath parameter on Publish
The problem with the -DestinationPath is that the command still try to upload the package to remote repository and if you don't provide an API key the command fail (after blocking the command line for a while) with a 401 error
I don't think it should be a separate cmdlet but -DestinationPath should be part of a separate parameterset. Unfortunately that would be abreaking change now for anyone already expecting it to do both.
As a workaround, you can Register-PSResourceRepository -Name 'Local' -Uri /path/you/want/to/save/the/nupkg and then publish to that and get the desired effect (make a nupkg without publishing to gallery/otherwise)