-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publish-Module Violates Single Responsibility Principle #1393
Comments
I also have had the same concern for a while. I would have wanted a |
@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 |
Today you can sort of accomplish this by using the |
The problem with the |
Prior to this change, the only way to get a local build for a packaged module was to manually register a local PSRepository, build and publish the module (manually publishing and external dependencies too), then review the `.nupkg` files. This change: - Creates the `Projects/ModulesTools/LocalRepoFunctions.ps1` script with helper functions for interacting with a temporary local repository, handling both PSResourceGet and PowerShellGet. It has functions to get/register/unregister the local repository, and to get, remove, and publish packages to the local repository. - Adds the new `Package` task to the shared build script, _not_ on a per-module basis. This task is invoked from `Projects/Modules` as: ```powershell Invoke-Build -Task Package ``` To compose and then package, run: ```powershell Invoke-Build -Task Compose, Package ``` At the end of the package step, all specified modules and any of their defined dependencies are published to the local repository. By default, this is in `Projects/Modules/.repository`. At the end of the task, the local repository is unregistered so as not to conflict with any other repositories. - This doesn't resolve (entirely) microsoft#116, which should implement per-module building and task management - however, it involved a significant amount of code for custom handling the packaging. For microsoft#116, we should instead wait for PowerShell/PSResourceGet#1393 and PowerShell/PSResourceGet#1034 to be resolved, and then we can use the built-in option to package the modules. Alternatively, we could explore using `dotnet pack` to package the modules after defining the `.nuspec` files ourselves. This would require a bit more work and introduce another dependency, but would be more portable and avoid the multi-API handling we have to do now. The last alternative is to just bump the required version for building modules to `7.4` or requiring **PSResourceGet** to be installed for the **Documentarian.DevX** module. This would be the easiest option.
Prior to this change, the only way to get a local build for a packaged module was to manually register a local PSRepository, build and publish the module (manually publishing and external dependencies too), then review the `.nupkg` files. This change: - Creates the `Projects/ModulesTools/LocalRepoFunctions.ps1` script with helper functions for interacting with a temporary local repository, handling both PSResourceGet and PowerShellGet. It has functions to get/register/unregister the local repository, and to get, remove, and publish packages to the local repository. - Adds the new `Package` task to the shared build script, _not_ on a per-module basis. This task is invoked from `Projects/Modules` as: ```powershell Invoke-Build -Task Package ``` To compose and then package, run: ```powershell Invoke-Build -Task Compose, Package ``` At the end of the package step, all specified modules and any of their defined dependencies are published to the local repository. By default, this is in `Projects/Modules/.repository`. At the end of the task, the local repository is unregistered so as not to conflict with any other repositories. - This doesn't resolve (entirely) microsoft#116, which should implement per-module building and task management - however, it involved a significant amount of code for custom handling the packaging. For microsoft#116, we should instead wait for PowerShell/PSResourceGet#1393 and PowerShell/PSResourceGet#1034 to be resolved, and then we can use the built-in option to package the modules. Alternatively, we could explore using `dotnet pack` to package the modules after defining the `.nuspec` files ourselves. This would require a bit more work and introduce another dependency, but would be more portable and avoid the multi-API handling we have to do now. The last alternative is to just bump the required version for building modules to `7.4` or requiring **PSResourceGet** to be installed for the **Documentarian.DevX** module. This would be the easiest option.
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:
and then, combined with
Publish-Module
, perhaps something like:The text was updated successfully, but these errors were encountered: