Skip to content

Instantly share code, notes, and snippets.

@ericjaystevens
Forked from RamblingCookieMonster/zModuleBuild.ps1
Last active May 23, 2021 20:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ericjaystevens/03a23ee76bd1992f9fb297dc8122351b to your computer and use it in GitHub Desktop.
Save ericjaystevens/03a23ee76bd1992f9fb297dc8122351b to your computer and use it in GitHub Desktop.
zModuleBuild.ps1
# We cloned our project to C:\sc\PSStackExchange
$ModuleName = 'PSmodName'
$Path = "$env:HOMEPATH\scripts\$($ModuleName)"
$Author = 'EricJayStevens'
$Description = 'PowerShell module to ...'
$version = $PSVersionTable.PSVersion | select -ExpandProperty Major
# Create the module and private function directories
mkdir $Path\$ModuleName
mkdir $Path\$ModuleName\Private
mkdir $Path\$ModuleName\Public
mkdir $Path\$ModuleName\en-US # For about_Help files
mkdir $Path\Tests
#Create the module and related files
New-Item "$Path\$ModuleName\$ModuleName.psm1" -ItemType File
New-Item "$Path\$ModuleName\$ModuleName.Format.ps1xml" -ItemType File
New-Item "$Path\$ModuleName\en-US\about_$($moduleName).help.txt" -ItemType File
New-Item "$Path\Tests\$($moduleName).Tests.ps1" -ItemType File
New-ModuleManifest -Path $Path\$ModuleName\$ModuleName.psd1 `
-RootModule $Path\$ModuleName\$ModuleName.psm1 `
-Description $Description `
-PowerShellVersion $version `
-Author $Author `
-FormatsToProcess "$ModuleName.Format.ps1xml"
# Copy the public/exported functions into the public folder, private functions into private folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment