Private/New-SpecModuleManifest.ps1

function New-SpecModuleManifest {
    <#
    .SYNOPSIS
    Creates a module manifest (.psd1) file for a specified PowerShell module.
 
    .DESCRIPTION
    The New-SpecModuleManifest function generates a module manifest file (.psd1) for a PowerShell module. It populates the manifest with relevant metadata such as the module name, version, author, description, and other attributes.
 
    .PARAMETER moduleName
    Specifies the name of the module.
 
    .PARAMETER modulePath
    Specifies the path to the module's root directory.
 
    .PARAMETER moduleShortDescription
    Specifies a short description of the module.
 
    .EXAMPLE
    New-SpecModuleManifest -moduleName "MyModule" -modulePath "C:\Path\To\Module" -moduleShortDescription "This module provides various utilities for XYZ."
 
    This example generates a module manifest file (MyModule.psd1) for a module named "MyModule" located at "C:\Path\To\Module".
 
    .NOTES
    Author : owen.heaume
    Version : 1.1
    #>


    [cmdletbinding()]

    param (
        [parameter (mandatory = $true)]
        [string]$moduleName,

        [parameter (mandatory = $true)]
        [string]$modulePath,

        [parameter (mandatory = $true)]
        [string]$moduleShortDescription
    )

    $tags = @('spec')
    $fullModulePath = Join-Path "$modulePath\$moduleName" $moduleName

    $params = @{
        path              = (join-path $fullModulePath "$moduleName.psd1")
        rootModule        = $moduleName
        moduleversion     = '1.0.0'
        author            = (Get-CimInstance -ClassName CIM_ComputerSystem).username | Split-Path -Leaf
        CompanyName       = 'Specsavers'
        Description       = $moduleShortDescription
        Powershellversion = '3.0'
        tags              = $tags
        releaseNotes      = '* 1.0.0 - Initial Release to PowerShell Gallery'
        Copyright         = '(c) 2023 Specsavers. All rights reserved.'
    }

    try {
        Write-verbose "Creating module manifest (.psd1)"
        New-ModuleManifest @params
        return $true
    } catch {
        write-warning "Unable to create the module manifest."
        return $false
    }
}