Modules/businessdev.ALbuild.Apps/businessdev.ALbuild.Apps.psm1
|
#Requires -Version 5.1 Set-StrictMode -Version Latest # Root loader for businessdev.ALbuild.Apps. # Dot-sources Classes -> Private -> Public and exports only the public functions. $ErrorActionPreference = 'Stop' $script:ModuleRoot = $PSScriptRoot foreach ($folder in 'Classes', 'Private', 'Public') { $path = Join-Path -Path $PSScriptRoot -ChildPath $folder if (-not (Test-Path -LiteralPath $path)) { continue } $files = Get-ChildItem -LiteralPath $path -Filter '*.ps1' -File -Recurse | Where-Object { $_.Name -notlike '*.Tests.ps1' } | Sort-Object FullName foreach ($file in $files) { try { . $file.FullName } catch { throw "businessdev.ALbuild.Apps: failed to load '$($file.FullName)': $($_.Exception.Message)" } } } $publicFunctions = @() $publicPath = Join-Path -Path $PSScriptRoot -ChildPath 'Public' if (Test-Path -LiteralPath $publicPath) { $publicFunctions = @(Get-ChildItem -LiteralPath $publicPath -Filter '*.ps1' -File -Recurse | Where-Object { $_.Name -notlike '*.Tests.ps1' } | ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension($_.Name) }) } Export-ModuleMember -Function $publicFunctions |