@@ -17,24 +17,26 @@ if($PSCmdlet.ParameterSetName -eq "GraphResource"){
1717}
1818$PackModulePS1 = Join-Path $ModuleProjLocation " /pack-module.ps1"
1919
20- # Pack module
21- & $PackModulePS1
22- if ($LASTEXITCODE ) {
23- Write-Error " Failed to pack '$Module ' module."
24- }
20+ if (Test-Path $PackModulePS1 ) {
21+ # Pack module
22+ & $PackModulePS1
23+ if ($LASTEXITCODE ) {
24+ Write-Error " Failed to pack '$Module ' module."
25+ }
2526
26- # Get generated .nupkg
27- $NuGetPackage = (Get-ChildItem (Join-Path $ModuleProjLocation " ./bin" ) | Where-Object Name -Match " .nupkg" ).FullName
27+ # Get generated .nupkg
28+ $NuGetPackage = (Get-ChildItem (Join-Path $ModuleProjLocation " ./bin" ) | Where-Object Name -Match " .nupkg" ).FullName
2829
29- $ModuleArtifactLocation = " $ArtifactsLocation \$Module "
30- if (-not (Test-Path $ModuleArtifactLocation )) {
31- New-Item - Path $ModuleArtifactLocation - Type Directory
32- } else {
33- Remove-Item - Path " $ModuleArtifactLocation \*" - Recurse - Force
34- }
30+ $ModuleArtifactLocation = " $ArtifactsLocation \$Module "
31+ if (-not (Test-Path $ModuleArtifactLocation )) {
32+ New-Item - Path $ModuleArtifactLocation - Type Directory
33+ } else {
34+ Remove-Item - Path " $ModuleArtifactLocation \*" - Recurse - Force
35+ }
3536
36- # Copy package to artifacts folder.
37- Write-Host - ForegroundColor Green " Copying '$NuGetPackage ' to $ModuleArtifactLocation ..."
38- Copy-Item - Path $NuGetPackage - Destination $ModuleArtifactLocation - Force
37+ # Copy package to artifacts folder.
38+ Write-Host - ForegroundColor Green " Copying '$NuGetPackage ' to $ModuleArtifactLocation ..."
39+ Copy-Item - Path $NuGetPackage - Destination $ModuleArtifactLocation - Force
3940
40- Write-Host - ForegroundColor Green " -------------Done-------------"
41+ Write-Host - ForegroundColor Green " -------------Done-------------"
42+ }
0 commit comments