Skip to content

Commit e0e03f9

Browse files
jshigetomiJustin Chungsdwheeler
authored
Add Compress-PSResource cmdlet Doc Added Publish-PSResource Nupkg Parameter (#156)
* Added new publish parameters and compress-psresource * Added Compress and added Parameter for publish * Editorial review --------- Co-authored-by: Justin Chung <[email protected]> Co-authored-by: Sean Wheeler <[email protected]>
1 parent 55802e2 commit e0e03f9

File tree

2 files changed

+214
-7
lines changed

2 files changed

+214
-7
lines changed
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
external help file: Microsoft.PowerShell.PSResourceGet.dll-Help.xml
3+
Module Name: Microsoft.PowerShell.PSResourceGet
4+
ms.custom: 1.1.0-preview.2
5+
ms.date: 09/13/2024
6+
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.psresourceget/compress-psresource?view=powershellget-3.x&WT.mc_id=ps-gethelp
7+
schema: 2.0.0
8+
---
9+
10+
# Compress-PSResource
11+
12+
## SYNOPSIS
13+
14+
Compresses a specified folder containing module or script resources into a `.nupkg` file.
15+
16+
## SYNTAX
17+
18+
```
19+
Compress-PSResource [-Path] <String> [-DestinationPath] <String> [-PassThru] [-WhatIf] [-Confirm]
20+
[<CommonsParameters>]
21+
```
22+
23+
## DESCRIPTION
24+
25+
This cmdlet compresses a specified folder containing module or script resources into a `.nupkg`
26+
file. isolates the pack feature in the `Publish-PSResource` cmdlet. This allows you to sign the
27+
`.nupkg` file before publishing it to a repository. You can publish the final `.nupkg` file using
28+
the **NupkgPath** parameter of `Publish-PSResource`.
29+
30+
This command was added in v1.1.0-preview.2 of **Microsoft.PowerShell.PSResourceGet**.
31+
32+
## EXAMPLES
33+
34+
### Example 1
35+
36+
This example compresses the module **TestModule** and saves te nupkg to the DestinationPath.
37+
38+
```powershell
39+
Compress-PSResource -Path C:\TestModule -DestinationPath C:\NupkgDestination
40+
```
41+
42+
## PARAMETERS
43+
44+
### -DestinationPath
45+
46+
Path to save the compressed resource.
47+
48+
```yaml
49+
Type: System.String
50+
Parameter Sets: (All)
51+
Aliases:
52+
53+
Required: True
54+
Position: 1
55+
Default value: None
56+
Accept pipeline input: False
57+
Accept wildcard characters: False
58+
```
59+
60+
### -PassThru
61+
62+
Pass the full path of the nupkg through the pipeline.
63+
64+
```yaml
65+
Type: System.Management.Automation.SwitchParameter
66+
Parameter Sets: (All)
67+
Aliases:
68+
69+
Required: False
70+
Position: Named
71+
Default value: None
72+
Accept pipeline input: False
73+
Accept wildcard characters: False
74+
```
75+
76+
### -Path
77+
78+
Path to the resource to be compressed.
79+
80+
```yaml
81+
Type: System.String
82+
Parameter Sets: (All)
83+
Aliases:
84+
85+
Required: True
86+
Position: 0
87+
Default value: None
88+
Accept pipeline input: False
89+
Accept wildcard characters: False
90+
```
91+
92+
### -SkipModuleManifestValidate
93+
94+
Skips validating the module manifest before publishing.
95+
96+
```yaml
97+
Type: System.Management.Automation.SwitchParameter
98+
Parameter Sets: (All)
99+
Aliases:
100+
101+
Required: False
102+
Position: Named
103+
Default value: None
104+
Accept pipeline input: False
105+
Accept wildcard characters: False
106+
```
107+
108+
### -Confirm
109+
110+
Prompts you for confirmation before running the cmdlet.
111+
112+
```yaml
113+
Type: System.Management.Automation.SwitchParameter
114+
Parameter Sets: (All)
115+
Aliases: cf
116+
117+
Required: False
118+
Position: Named
119+
Default value: None
120+
Accept pipeline input: False
121+
Accept wildcard characters: False
122+
```
123+
124+
### -WhatIf
125+
126+
Shows what would happen if the cmdlet runs. The cmdlet isn't run.
127+
128+
```yaml
129+
Type: System.Management.Automation.SwitchParameter
130+
Parameter Sets: (All)
131+
Aliases: wi
132+
133+
Required: False
134+
Position: Named
135+
Default value: None
136+
Accept pipeline input: False
137+
Accept wildcard characters: False
138+
```
139+
140+
### CommonParameters
141+
142+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
143+
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
144+
-WarningAction, and -WarningVariable. For more information, see
145+
[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
146+
147+
## INPUTS
148+
149+
### None
150+
151+
## OUTPUTS
152+
153+
### System.String
154+
155+
By default, this command doesn't write any output to the pipeline. When you use the **PassThru**
156+
parameter, it returns full path of the `.nupkg` that was created.
157+
158+
## NOTES
159+
160+
The module defines `cmres` as an alias for `Compress-PSResource`.
161+
162+
This cmdlet allows for publishing nuspec dependencies into ACR.
163+
164+
## RELATED LINKS
165+
166+
[Publish-PSResource](Publish-PSResource.md)

powershell-gallery/powershellget-3.x/Microsoft.PowerShell.PSResourceGet/Publish-PSResource.md

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
external help file: Microsoft.PowerShell.PSResourceGet.dll-Help.xml
33
Module Name: Microsoft.PowerShell.PSResourceGet
4-
ms.custom: 1.0.5
5-
ms.date: 05/17/2024
4+
ms.custom: 1.1.0-preview.2
5+
ms.date: 09/13/2024
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.psresourceget/publish-psresource?view=powershellget-3.x&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
---
@@ -15,19 +15,29 @@ Publishes a specified module from the local computer to PSResource repository.
1515

1616
## SYNTAX
1717

18+
### PathParameterSet
19+
1820
```
1921
Publish-PSResource [-ApiKey <String>] [-Repository <String>] [-Path] <String>
2022
[-DestinationPath <String>] [-Credential <PSCredential>] [-SkipDependenciesCheck]
21-
[-SkipModuleManifestValidate] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-WhatIf] [-Confirm]
22-
[<CommonParameters>]
23+
[-SkipModuleManifestValidate] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-WhatIf]
24+
[-Confirm] [<CommonParameters>]
25+
```
26+
27+
### NupkgPathParameterSet
28+
29+
```
30+
Publish-PSResource [-ApiKey <String>] [-Repository <String>] [-DestinationPath <String>]
31+
[-Credential <PSCredential>] [-SkipDependenciesCheck] [-SkipModuleManifestValidate] [-Proxy <Uri>]
32+
[-ProxyCredential <PSCredential>] -NupkgPath <String> [-WhatIf] [-Confirm] [<CommonParameters>]
2333
```
2434

2535
## DESCRIPTION
2636

2737
This cmdlet combines the functions of the `Publish-Module` and `Publish-Script` cmdlets from
2838
**PowerShellGet** v2. `Publish-PSResource` publishes a resource from the local computer to an online
29-
Nuget-based repository. You can specify the resource by the resource's name or by the path
30-
containing the module or script resource.
39+
NuGet-based repository. You can specify the resource by a path containing the module or script
40+
resource files or by pointing a prepackaged `.nupkg` file.
3141

3242
## EXAMPLES
3343

@@ -48,6 +58,14 @@ that's generated by the PowerShell Gallery for a user account.
4858
Publish-PSResource -Path c:\TestModule -Repository PSGallery -APIKey '1234567'
4959
```
5060

61+
### Example 3
62+
63+
This example publishes the module Nupkg **TestModule.nupkg** to a repositroy named TestRepository.
64+
65+
```powershell
66+
Publish-PSResource -NupkgPath c:\TestModule.nupkg -Repository TestRepository
67+
```
68+
5169
## PARAMETERS
5270

5371
### -ApiKey
@@ -100,10 +118,31 @@ Accept pipeline input: False
100118
Accept wildcard characters: False
101119
```
102120

121+
### -NupkgPath
122+
123+
Path to the `.nupkg` file to be published. The `.nupkg` file could have been created by a previous
124+
run of `Publish-PSResource` with the **DestinationPath** parameter. Or, you can create the `.nupkg`
125+
file using the `Compress-PSResource` command.
126+
127+
This parameter was added in v1.1.0-preview.2 of **Microsoft.PowerShell.PSResourceGet**.
128+
129+
```yaml
130+
Type: System.String
131+
Parameter Sets: NupkgPathParameterSet
132+
Aliases:
133+
134+
Required: True
135+
Position: Named
136+
Default value: None
137+
Accept pipeline input: False
138+
Accept wildcard characters: False
139+
```
140+
103141
### -Path
104142

105143
The path to the module or script file or the path to a folder containing the module or script file
106-
to be published.
144+
to be published. The cmdlet packages all files in the folder into a `.nupkg` file before publishing
145+
to the repository.
107146

108147
```yaml
109148
Type: System.String
@@ -252,3 +291,5 @@ Fileshare-based repository have no metadata about the resources. Therefore, ther
252291
for dependencies.
253292

254293
## RELATED LINKS
294+
295+
[Compress-PSResource](Compress-PSResource.md)

0 commit comments

Comments
 (0)