Public/New-specModule.ps1

Function New-specModule {
    <#
    .SYNOPSIS
        Automates the creation of a basic PowerShell module structure, including necessary files and configuration for Pester testing and PowerShell Gallery publishing.
 
    .DESCRIPTION
        This function streamlines the setup of a new PowerShell module by creating the following:
            * A root folder with standard subfolders ('Tests', module folder, 'en-US', 'Public', 'Private').
            * A README.md file.
            * A Test.ps1 file with basic Pester configuration.
            * A Pester tests file (.tests.ps1).
            * An 'about_' help file.
            * A module manifest (.psd1) file.
            * A module loader (.psm1) file.
            * YAML configuration files for Pester testing and PowerShell Gallery publishing pipelines.
 
    .PARAMETER path
        Required. The base path where the module structure will be created.
 
    .PARAMETER Name
        Required. The name of the new module.
 
    .PARAMETER ShortDescription
        Required. A concise description of the module's functionality.
 
    .PARAMETER DevOpsPath
        Required. The relative path to the module folder within your DevOps repository.
 
    .EXAMPLE
        New-specModule -path C:\Dev\Modules -Name MyModule -ShortDescription "Provides data processing tools" -DevOpsPath "Modules"
 
    .NOTES
        Author: owen.heaume
        Version: 1.0.0 - Initial release
    #>


    [cmdletbinding()]

    param(
        [parameter (Mandatory)]
        [string]$path,

        [parameter (Mandatory)]
        [string]$Name,

        [parameter (Mandatory)]
        [string]$ShortDescription,

        [Parameter(Mandatory)]
        [string]$DevOpsPath
    )

    Begin {}

    Process {
                # 1. Create the folder structure
                $paths = New-FolderStructure -Path $Path -Name $Name
                Write-Host ""

                # 2. Create the Pester YAML file
                New-PesterYamlFile -Path $Path -Name $Name -DevOpsPath $DevOpsPath
                Write-Host ""

                # 3. Create the PSGallery YAML file
                New-PSGalleryYamlFile -Path $Path -Name $Name -DevOpsPath $DevOpsPath
                Write-Host ""

                # 4. create the README.md file
                New-ReadMe -Path $paths.folderPath -Name $name
                Write-Host ""

                # 5. Create the Test.ps1 file
                New-TestFile -Path $paths.folderpath -Name $name
                Write-Host ""

                # 6. Create the Pester tests file
                New-PesterTestsFile -Path $paths.tests -Name $Name
                write-host ""

                # 7. Create the about file
                New-AboutFile -Path $paths.enus -Name $name -moduleShortDescription $ShortDescription
                write-host ""

                # 8. Create the module manifest psd1 file
                New-Psd1File -path $paths.module -name $name -moduleShortDescription $ShortDescription
                write-host ""

                #9. Create the module psm1 file
                New-Psm1File -path $paths.module -name $Name
                write-host ""
    }

    End {
        Write-Host "Module '$name' has been setup successfully" -ForegroundColor DarkGreen
    }
}