private/Check-Module.ps1
function Check-Module { if ( $env:localTesting -ne $true ) { $remoteVersion = ( Invoke-RestMethod "https://www.powershellgallery.com/api/v2/Packages?`$filter=Id eq 'nimbus' and IsLatestVersion" ).properties.NormalizedVersion $localVersion = ( Get-Module -Name nimbus ).version if ( $remoteVersion -ne $localVersion ) { Write-Error "Running a non-latest version is not supported." Write-Error "Update Nimbus module to the latest version." exit 1 } Write-Output "Using the latest version." } } |