New-ModuleManifest.ps1

#Requires -Version 7

# Helper Variables
$InvocationRoot = Split-Path $MyInvocation.MyCommand.Path
$ChildItems = Get-ChildItem $InvocationRoot -File -Recurse
$ModuleName = Split-Path (Split-Path $InvocationRoot) -Leaf

# New-ModuleManifest

$Splat = Get-Content (Join-Path $InvocationRoot "ModuleManifest.json") -ErrorAction SilentlyContinue | ConvertFrom-Json -AsHashtable

@{
    Path              = Join-Path $InvocationRoot ('{0}.psd1' -f $ModuleName)
    RootModule        = '.\RootModule.psm1'
    ModuleVersion     = Split-Path $InvocationRoot -Leaf
    Author            = $Author
    FunctionsToExport = $ChildItems | Where-Object { $_.FullName -match 'FunctionsToExport' -and $_.BaseName -match '^Function_' -and $_.Extension -match '.ps1' } | ForEach-Object { ($_.BaseName).Substring(9) }
    CmdletsToExport   = @()
    VariablesToExport = @()
    AliasesToExport   = @()
    Verbose           = $true
}.GetEnumerator() | ForEach-Object { if (-not $Splat[$_.Key]) { $Splat[$_.Key] = $_.Value } }

$Splat

New-ModuleManifest @Splat