Private/New-SpecModuleStructure.ps1

function New-SpecModuleStructure {
    <#
    .SYNOPSIS
    Creates a standard folder structure for a new PowerShell module.
 
    .DESCRIPTION
    The New-SpecModuleStructure function generates a standard folder structure for a new PowerShell module. It creates the necessary directories for the module, including "Public," "Private," "en-US," and "Tests" subdirectories within the module's root directory.
 
    .PARAMETER moduleName
    Specifies the name of the module.
 
    .PARAMETER modulePath
    Specifies the path where the module's root directory should be created.
 
    .EXAMPLE
    New-SpecModuleStructure -moduleName "MyModule" -modulePath "C:\Path\To\Module"
 
    This example creates a standard folder structure 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
    )

    try {
        $RootModulePath = Join-Path "$modulePath" $moduleName
        $fullModulePath = Join-Path "$modulePath\$modulename" $moduleName

        write-verbose "creating root directory: $(Join-Path $modulePath $moduleName)"
        New-Item -Path $modulePath -Name $moduleName -ItemType Directory -ErrorAction Stop | Out-Null

        write-verbose "creating Module directory: $(Join-Path "$modulePath\$Modulename" $moduleName)"
        New-Item -Path "$modulePath\$modulename" -Name $moduleName -ItemType Directory -ErrorAction Stop | Out-Null

        write-verbose "Creating Public folder: $fullModulePath\Public"
        New-Item -Path $fullModulePath -Name 'Public' -ItemType Directory -ErrorAction Stop | Out-Null

        write-verbose "Creating Private folder: $fullModulePath\Private"
        New-Item -Path $fullModulePath -Name 'Private' -ItemType Directory -ErrorAction Stop | Out-Null

        write-verbose "Creating Private folder: $fullModulePath\en-US"
        New-Item -Path $fullModulePath -Name 'en-US' -ItemType Directory -ErrorAction Stop | Out-Null

        write-verbose "Creating Tests folder: $RootModulePath\Tests"
        New-Item -Path $RootModulePath -Name 'Tests' -ItemType Directory -ErrorAction Stop | Out-Null

        return $true
    } catch {
        return $false
    }
}