From 98e56ecdcee13ee3813bc5180220ff76786c88a1 Mon Sep 17 00:00:00 2001 From: Justin Chung Date: Wed, 11 Sep 2024 15:58:53 -0500 Subject: [PATCH 1/3] Added new publish parameters and compress-psresource --- .../Compress-PSResource.md | 61 +++++++++++++++++++ .../Publish-PSResource.md | 17 ++++-- 2 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Compress-PSResource.md diff --git a/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Compress-PSResource.md b/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Compress-PSResource.md new file mode 100644 index 0000000..6c9ba8b --- /dev/null +++ b/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Compress-PSResource.md @@ -0,0 +1,61 @@ +--- +external help file: Microsoft.PowerShell.PSResourceGet.dll-Help.xml +Module Name: Microsoft.PowerShell.PSResourceGet +ms.custom: 1.0.5 +ms.date: 05/17/2024 +online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.psresourceget/compress-psresource?view=powershellget-3.x&WT.mc_id=ps-gethelp +schema: 2.0.0 +--- + +# Compress-PSResource + +## SYNOPSIS + +Compresses a specified module from the local computer to a Nupkg ready to be signed and published. + +## SYNTAX + +``` +Compress-PSResource [-Path] [-DestinationPath] [-PassThru] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION + +This cmdlet isolates the pack feature in the Publish-PSResource cmdlet. This cmdlet takes the path +to a PowerShell Module and packs it into a nupkg file saved at the DestinationPath. +This allows users to sign the nupkg file. To publish the nupkg use the -NupkgPath parameter with +Publish-PSResource. + +## EXAMPLES + +### Example 1 + +This example compresses the module **TestModule** and saves te nupkg to the DestinationPath. + +```powershell +Compress-PSResource -Path C:\TestModule -DestinationPath C:\NupkgDestination +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object + +## NOTES + +The module defines `cmres` as an alias for `Compress-PSResource`. + +This cmdlet allows for publishing nuspec dependencies into ACR + +## RELATED LINKS diff --git a/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Publish-PSResource.md b/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Publish-PSResource.md index 48a8735..dca5ac6 100644 --- a/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Publish-PSResource.md +++ b/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Publish-PSResource.md @@ -16,9 +16,10 @@ Publishes a specified module from the local computer to PSResource repository. ## SYNTAX ``` -Publish-PSResource [-ApiKey ] [-Repository ] [-Path] - [-DestinationPath ] [-Credential ] [-SkipDependenciesCheck] - [-SkipModuleManifestValidate] [-Proxy ] [-ProxyCredential ] [-WhatIf] [-Confirm] +Publish-PSResource [-NupkgPath ] [-ApiKey ] [-Repository ] + [-Path] [-DestinationPath ] [-Credential ] + [-SkipDependenciesCheck] [-SkipModuleManifestValidate] [-Proxy ] + [-ProxyCredential ] [-WhatIf] [-Confirm] [] ``` @@ -26,7 +27,7 @@ Publish-PSResource [-ApiKey ] [-Repository ] [-Path] This cmdlet combines the functions of the `Publish-Module` and `Publish-Script` cmdlets from **PowerShellGet** v2. `Publish-PSResource` publishes a resource from the local computer to an online -Nuget-based repository. You can specify the resource by the resource's name or by the path +NuGet-based repository. You can specify the resource by the resource's name or by the path containing the module or script resource. ## EXAMPLES @@ -48,6 +49,14 @@ that's generated by the PowerShell Gallery for a user account. Publish-PSResource -Path c:\TestModule -Repository PSGallery -APIKey '1234567' ``` +### Example 3 + +This example publishes the module Nupkg **TestModule.nupkg** to a repositroy named TestRepository. + +```powershell +Publish-PSResource -NupkgPath c:\TestModule.nupkg -Repository TestRepository +``` + ## PARAMETERS ### -ApiKey From 1e97a2893aaace35c72104a6f15924d30b01562c Mon Sep 17 00:00:00 2001 From: Justin Chung Date: Fri, 13 Sep 2024 12:50:27 -0500 Subject: [PATCH 2/3] Added Compress and added Parameter for publish --- .../Compress-PSResource.md | 103 +++++++++++++++++- .../Publish-PSResource.md | 38 ++++++- 2 files changed, 134 insertions(+), 7 deletions(-) diff --git a/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Compress-PSResource.md b/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Compress-PSResource.md index 6c9ba8b..b12fc4b 100644 --- a/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Compress-PSResource.md +++ b/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Compress-PSResource.md @@ -23,8 +23,8 @@ Compress-PSResource [-Path] [-DestinationPath] [-PassThru] [-W ## DESCRIPTION This cmdlet isolates the pack feature in the Publish-PSResource cmdlet. This cmdlet takes the path -to a PowerShell Module and packs it into a nupkg file saved at the DestinationPath. -This allows users to sign the nupkg file. To publish the nupkg use the -NupkgPath parameter with +to a PowerShell Module and packs it into a nupkg file saved at the DestinationPath. This allows +users to sign the nupkg file. To publish the nupkg use the -NupkgPath parameter with Publish-PSResource. ## EXAMPLES @@ -37,6 +37,105 @@ This example compresses the module **TestModule** and saves te nupkg to the Dest Compress-PSResource -Path C:\TestModule -DestinationPath C:\NupkgDestination ``` +## PARAMETERS + +### -DestinationPath + +Path to save the compressed resource. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru + +Pass the full path of the nupkg through the pipeline + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Path + +Path to the resource to be compressed. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipModuleManifestValidate + +Skips validating the module manifest before publishing. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf + +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, diff --git a/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Publish-PSResource.md b/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Publish-PSResource.md index dca5ac6..f90d16d 100644 --- a/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Publish-PSResource.md +++ b/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Publish-PSResource.md @@ -1,7 +1,7 @@ --- external help file: Microsoft.PowerShell.PSResourceGet.dll-Help.xml Module Name: Microsoft.PowerShell.PSResourceGet -ms.custom: 1.0.5 +ms.custom: 1.1.0 Preview 2 ms.date: 05/17/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.psresourceget/publish-psresource?view=powershellget-3.x&WT.mc_id=ps-gethelp schema: 2.0.0 @@ -15,12 +15,24 @@ Publishes a specified module from the local computer to PSResource repository. ## SYNTAX +### PathParameterSet + +``` +Publish-PSResource [-ApiKey ] [-Repository ] [-Path] + [-DestinationPath ] [-Credential ] + [-SkipDependenciesCheck] [-SkipModuleManifestValidate] [-Proxy ] + [-ProxyCredential ] [-ProgressAction ] + [-WhatIf] [-Confirm] [] +``` + +### NupkgPathParameterSet + ``` -Publish-PSResource [-NupkgPath ] [-ApiKey ] [-Repository ] - [-Path] [-DestinationPath ] [-Credential ] +Publish-PSResource [-ApiKey ] [-Repository ] + [-DestinationPath ] [-Credential ] [-SkipDependenciesCheck] [-SkipModuleManifestValidate] [-Proxy ] - [-ProxyCredential ] [-WhatIf] [-Confirm] - [] + [-ProxyCredential ] -NupkgPath + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -109,6 +121,22 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -NupkgPath + +Path to the resource to be published. + +```yaml +Type: System.String +Parameter Sets: NupkgPathParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Path The path to the module or script file or the path to a folder containing the module or script file From 900c1d2d5191254ca773c1f5f6cbd6a565f9ddec Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Fri, 13 Sep 2024 17:01:21 -0500 Subject: [PATCH 3/3] Editorial review --- .../Compress-PSResource.md | 34 +++++++++++-------- .../Publish-PSResource.md | 34 +++++++++++-------- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Compress-PSResource.md b/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Compress-PSResource.md index b12fc4b..f880a9b 100644 --- a/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Compress-PSResource.md +++ b/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Compress-PSResource.md @@ -1,8 +1,8 @@ --- external help file: Microsoft.PowerShell.PSResourceGet.dll-Help.xml Module Name: Microsoft.PowerShell.PSResourceGet -ms.custom: 1.0.5 -ms.date: 05/17/2024 +ms.custom: 1.1.0-preview.2 +ms.date: 09/13/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.psresourceget/compress-psresource?view=powershellget-3.x&WT.mc_id=ps-gethelp schema: 2.0.0 --- @@ -11,21 +11,23 @@ schema: 2.0.0 ## SYNOPSIS -Compresses a specified module from the local computer to a Nupkg ready to be signed and published. +Compresses a specified folder containing module or script resources into a `.nupkg` file. ## SYNTAX ``` -Compress-PSResource [-Path] [-DestinationPath] [-PassThru] [-WhatIf] - [-Confirm] [] +Compress-PSResource [-Path] [-DestinationPath] [-PassThru] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION -This cmdlet isolates the pack feature in the Publish-PSResource cmdlet. This cmdlet takes the path -to a PowerShell Module and packs it into a nupkg file saved at the DestinationPath. This allows -users to sign the nupkg file. To publish the nupkg use the -NupkgPath parameter with -Publish-PSResource. +This cmdlet compresses a specified folder containing module or script resources into a `.nupkg` +file. isolates the pack feature in the `Publish-PSResource` cmdlet. This allows you to sign the +`.nupkg` file before publishing it to a repository. You can publish the final `.nupkg` file using +the **NupkgPath** parameter of `Publish-PSResource`. + +This command was added in v1.1.0-preview.2 of **Microsoft.PowerShell.PSResourceGet**. ## EXAMPLES @@ -57,7 +59,7 @@ Accept wildcard characters: False ### -PassThru -Pass the full path of the nupkg through the pipeline +Pass the full path of the nupkg through the pipeline. ```yaml Type: System.Management.Automation.SwitchParameter @@ -121,8 +123,7 @@ Accept wildcard characters: False ### -WhatIf -Shows what would happen if the cmdlet runs. -The cmdlet is not run. +Shows what would happen if the cmdlet runs. The cmdlet isn't run. ```yaml Type: System.Management.Automation.SwitchParameter @@ -149,12 +150,17 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### System.Object +### System.String + +By default, this command doesn't write any output to the pipeline. When you use the **PassThru** +parameter, it returns full path of the `.nupkg` that was created. ## NOTES The module defines `cmres` as an alias for `Compress-PSResource`. -This cmdlet allows for publishing nuspec dependencies into ACR +This cmdlet allows for publishing nuspec dependencies into ACR. ## RELATED LINKS + +[Publish-PSResource](Publish-PSResource.md) diff --git a/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Publish-PSResource.md b/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Publish-PSResource.md index f90d16d..6ddcb87 100644 --- a/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Publish-PSResource.md +++ b/powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Publish-PSResource.md @@ -1,8 +1,8 @@ --- external help file: Microsoft.PowerShell.PSResourceGet.dll-Help.xml Module Name: Microsoft.PowerShell.PSResourceGet -ms.custom: 1.1.0 Preview 2 -ms.date: 05/17/2024 +ms.custom: 1.1.0-preview.2 +ms.date: 09/13/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.psresourceget/publish-psresource?view=powershellget-3.x&WT.mc_id=ps-gethelp schema: 2.0.0 --- @@ -19,28 +19,25 @@ Publishes a specified module from the local computer to PSResource repository. ``` Publish-PSResource [-ApiKey ] [-Repository ] [-Path] - [-DestinationPath ] [-Credential ] - [-SkipDependenciesCheck] [-SkipModuleManifestValidate] [-Proxy ] - [-ProxyCredential ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] + [-DestinationPath ] [-Credential ] [-SkipDependenciesCheck] + [-SkipModuleManifestValidate] [-Proxy ] [-ProxyCredential ] [-WhatIf] + [-Confirm] [] ``` ### NupkgPathParameterSet ``` -Publish-PSResource [-ApiKey ] [-Repository ] - [-DestinationPath ] [-Credential ] - [-SkipDependenciesCheck] [-SkipModuleManifestValidate] [-Proxy ] - [-ProxyCredential ] -NupkgPath - [-ProgressAction ] [-WhatIf] [-Confirm] [] +Publish-PSResource [-ApiKey ] [-Repository ] [-DestinationPath ] + [-Credential ] [-SkipDependenciesCheck] [-SkipModuleManifestValidate] [-Proxy ] + [-ProxyCredential ] -NupkgPath [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION This cmdlet combines the functions of the `Publish-Module` and `Publish-Script` cmdlets from **PowerShellGet** v2. `Publish-PSResource` publishes a resource from the local computer to an online -NuGet-based repository. You can specify the resource by the resource's name or by the path -containing the module or script resource. +NuGet-based repository. You can specify the resource by a path containing the module or script +resource files or by pointing a prepackaged `.nupkg` file. ## EXAMPLES @@ -123,7 +120,11 @@ Accept wildcard characters: False ### -NupkgPath -Path to the resource to be published. +Path to the `.nupkg` file to be published. The `.nupkg` file could have been created by a previous +run of `Publish-PSResource` with the **DestinationPath** parameter. Or, you can create the `.nupkg` +file using the `Compress-PSResource` command. + +This parameter was added in v1.1.0-preview.2 of **Microsoft.PowerShell.PSResourceGet**. ```yaml Type: System.String @@ -140,7 +141,8 @@ Accept wildcard characters: False ### -Path The path to the module or script file or the path to a folder containing the module or script file -to be published. +to be published. The cmdlet packages all files in the folder into a `.nupkg` file before publishing +to the repository. ```yaml Type: System.String @@ -289,3 +291,5 @@ Fileshare-based repository have no metadata about the resources. Therefore, ther for dependencies. ## RELATED LINKS + +[Compress-PSResource](Compress-PSResource.md)