tasks/Generate_Wiki_Sidebar_Custom.build.ps1

<#
    .SYNOPSIS
        This is a build task that creates a custom GitHub Wiki sidebar based on
        markdown files in the Wiki output folder.

    .PARAMETER ProjectPath
        The root path to the project. Defaults to $BuildRoot.

    .PARAMETER OutputDirectory
        The base directory of all output. Defaults to folder 'output' relative to
        the $BuildRoot.

    .PARAMETER BuildInfo
        The build info object from ModuleBuilder. Defaults to an empty hashtable.

    .NOTES
        This is a build task that is primarily meant to be run by Invoke-Build but
        wrapped by the Sampler project's build.ps1 (https://github.com/gaelcolas/Sampler).
#>

param
(
    [Parameter()]
    [System.String]
    $ProjectPath = (property ProjectPath $BuildRoot),

    [Parameter()]
    [System.String]
    $OutputDirectory = (property OutputDirectory (Join-Path $BuildRoot 'output')),

    [Parameter()]
    [System.Collections.Hashtable]
    $BuildInfo = (property BuildInfo @{ })
)

# Synopsis: Generate a custom GitHub Wiki sidebar from markdown files.
task Generate_Wiki_Sidebar_Custom {
    $SidebarParams = @{
        ModuleName     = Get-SamplerProjectName -BuildRoot $BuildRoot
        OutputPath     = $OutputDirectory
        WikiSourcePath = Join-Path -Path $OutputDirectory -ChildPath 'WikiContent'
        addHierarchy   = $true
    }

    New-WikiSidebarCustom @SidebarParams
}