diff --git a/scripts/Create-Release.ps1 b/scripts/Create-Release.ps1 index 95024a5..329de18 100644 --- a/scripts/Create-Release.ps1 +++ b/scripts/Create-Release.ps1 @@ -52,10 +52,23 @@ foreach (`$dll in `$dllFiles) { } } -# Export all cmdlets from the PSD1 file +# PowerShell will automatically export the cmdlets based on the [Cmdlet] attribute "@ Set-Content -Path $psm1Path -Value $psm1Content +# Test the module import +Write-Host "Testing module import..." +try { + Import-Module "$PSScriptRoot\..\output\PSOPNSenseAPI\PSOPNSenseAPI.psd1" -Force -Verbose + $cmdlets = Get-Command -Module PSOPNSenseAPI + Write-Host "Successfully imported module with $($cmdlets.Count) cmdlets" + Remove-Module PSOPNSenseAPI -Force -ErrorAction SilentlyContinue +} +catch { + Write-Error "Failed to import module: $_" + exit 1 +} + # Create a release archive $zipFile = "output\PSOPNSenseAPI-$version.zip" Compress-Archive -Path "output\PSOPNSenseAPI\*" -DestinationPath $zipFile -Force