From 7a2331bf742feb1adb7d8e118c1705866dcb9ca9 Mon Sep 17 00:00:00 2001 From: GraceSolutions Date: Tue, 15 Apr 2025 00:53:57 -0400 Subject: [PATCH] Update Create-Release.ps1 to test module import --- scripts/Create-Release.ps1 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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