PSGalleryTracker.psm1

$PrivateDirectory = Join-Path $PSScriptRoot 'Private'
$PublicDirectory  = Join-Path $PSScriptRoot 'Public'

# Dot-source private helpers
Get-ChildItem -LiteralPath $PrivateDirectory -Filter '*.ps1' -File | ForEach-Object {
    . $_.FullName
}

# Dot-source public functions
$PublicFunctions = Get-ChildItem -LiteralPath $PublicDirectory -Filter '*.ps1' -File
$PublicFunctions | ForEach-Object {
    . $_.FullName
}

# Export public functions
$ExportFunctions = [string[]]@()
$PublicFunctions | ForEach-Object {
    if (Test-Path -LiteralPath "Function:/$($_.BaseName)") {
        $ExportFunctions += $_.BaseName
    }
}
if ($ExportFunctions.Count -ge 1) {
    Export-ModuleMember -Function $ExportFunctions
}