Build.ps1
$Global:ErrorActionPreference = 'Stop' $Global:VerbosePreference = 'SilentlyContinue' $buildVersion = $env:BUILD_VERSION $manifestPath = "./Logic.Monitor.SE.psd1" $publicFuncFolderPath = './Public' if (!(Get-PackageProvider | Where-Object { $_.Name -eq 'NuGet' })) { Install-PackageProvider -Name NuGet -force | Out-Null } Import-PackageProvider -Name NuGet -force | Out-Null if ((Get-PSRepository -Name PSGallery).InstallationPolicy -ne 'Trusted') { Set-PSRepository -Name PSGallery -InstallationPolicy Trusted } if(!(Get-Module Logic.Monitor -ListAvailable)){ Install-Module Logic.Monitor -Force -Confirm:$false } if(!(Get-Module PSWriteHTML -ListAvailable)){ Install-Module PSWriteHTML -Force -Confirm:$false } if(!(Get-Module Pode -ListAvailable)){ Install-Module Pode -Force -Confirm:$false } $manifestContent = (Get-Content -Path $manifestPath -Raw) -replace '<ModuleVersion>', $buildVersion if ((Test-Path -Path $publicFuncFolderPath) -and ($publicFunctionNames = Get-ChildItem -Path $publicFuncFolderPath -Filter '*.ps1' | Select-Object -ExpandProperty BaseName)) { $funcStrings = "'$($publicFunctionNames -join "','")'" } else { $funcStrings = $null } $manifestContent = $manifestContent -replace "'<FunctionsToExport>'", $funcStrings $manifestContent | Set-Content -Path $manifestPath |