{"id":14063969,"url":"https://github.com/tinuwalther/PSModuleTemplate","last_synced_at":"2025-07-29T17:31:21.307Z","repository":{"id":42152409,"uuid":"206803615","full_name":"tinuwalther/PSModuleTemplate","owner":"tinuwalther","description":"PowerShell Module Template","archived":false,"fork":false,"pushed_at":"2023-11-14T19:03:25.000Z","size":57,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-01T07:07:07.049Z","etag":null,"topics":["powershell","powershell-module","powershell-template"],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tinuwalther.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-09-06T13:48:54.000Z","updated_at":"2023-03-07T19:28:27.000Z","dependencies_parsed_at":"2023-11-14T20:24:09.144Z","dependency_job_id":"9b1a7307-3f11-49e1-a48f-75d0d29279d2","html_url":"https://github.com/tinuwalther/PSModuleTemplate","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinuwalther%2FPSModuleTemplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinuwalther%2FPSModuleTemplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinuwalther%2FPSModuleTemplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinuwalther%2FPSModuleTemplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinuwalther","download_url":"https://codeload.github.com/tinuwalther/PSModuleTemplate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228032919,"owners_count":17858917,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["powershell","powershell-module","powershell-template"],"created_at":"2024-08-13T07:03:36.052Z","updated_at":"2024-12-04T02:30:58.414Z","avatar_url":"https://github.com/tinuwalther.png","language":"PowerShell","funding_links":[],"categories":["PowerShell"],"sub_categories":[],"readme":"# Table of Contents\n\n- [Table of Contents](#table-of-contents)\n- [PowerShell Module Template](#powershell-module-template)\n  - [README](#readme)\n  - [CHANGELOG](#changelog)\n  - [CI](#ci)\n    - [Build-Module.ps1](#build-moduleps1)\n      - [Usage](#usage)\n    - [Module-Settings.json](#module-settingsjson)\n  - [Code](#code)\n    - [Get-PRETemplate.ps1](#get-pretemplateps1)\n    - [Write-PRELog.ps1](#write-prelogps1)\n  - [Module-Folder](#module-folder)\n    - [Manifest-File](#manifest-file)\n    - [Module-File](#module-file)\n  - [Tests](#tests)\n    - [Functions.Tests.ps1](#functionstestsps1)\n    - [Failed.Tests.json](#failedtestsjson)\n    - [Module.Tests.ps1](#moduletestsps1)\n\n# PowerShell Module Template\n\nHow to create a new PowerShell-Module with PSModuleTemplate?\n\n1. Create a new project in Git and clone it to your computer\n2. git clone \u003chttps://github.com/tinuwalther/PSModuleTemplate.git\u003e  \n3. Copy the content from PSModuleTemplate into your new project\n4. Update the README.md with your information\n5. Save your function-files in the folder Code\n6. Build your Module with Build-Module.ps1\n\n## README\n\nInformation about your project.\n\n## CHANGELOG\n\nThe Build-Module.ps1 update this file with your last change description.\n\n## CI\n\nThis is the folder for all Continous Integration scripts like a script to automate the Module-File (Build-Module.ps1) and other scripts.\n\n### Build-Module.ps1\n\nThis script builds your module automatically.  \n\nBuild-Module.ps1 running the Functions.Tests.ps1, if no errors occured it delete the existent Module-File (PSM1) and create a new Module-File (PSM1) with all of your functions.\nThe script also updates the Manifest-File (PSD1) with the functions to export. If the Manifest-File doesn't exists, it will be created.\n\nFinally Build-Module.ps1 tests if your Module can be imported and removed without any errors. It tests also if the Module contains all of your exported functions.\n\n#### Usage\n\nOpen the Terminal and navigate to the Git-Project. Start the Build-Module.ps1 and enter the answers:\n\n````PowerShell\n./CI/Build-Module.ps1\n`````\n\n`````text\n[BUILD] [START] Launching Build Process\nEnter the name of the module without the extension: Test-PSModuleTemplate\nEnter the Version number of this module in the Semantic Versioning notation [1.0.0]: 0.0.1\nEnter the Description of the functionality provided by this module: This is a PowerShell-Module to create simple PowerShell-Modules\nEnter the Author of this module: Martin Walther  \nEnter the Company or vendor of this module: Martin Walther Foto \u0026 IT\nEnter the Prefix for all functions of this module: MWA\nDescribe what did you change: Initial upload\n[BUILD] [TEST]  Running Function-Tests\n\nStarting discovery in 1 files.\nDiscovery found 0 tests in 13ms.\nRunning tests.\nTests completed in 13ms\nTests Passed: 0, Failed: 0, Skipped: 0 NotRun: 0\n\n[BUILD] [Code ] Loading Class, public and private functions\n[BUILD] [START] [PSM1] Building Module PSM1\n[BUILD] [END  ] [PSM1] building Module PSM1 \n[BUILD] [START] [PSD1] Manifest PSD1\n[BUILD] [PSD1 ] Adding functions to export\n[BUILD] [END  ] [PSD1] building Manifest\n[BUILD] [END]   Launching Build Process\n`````\n\n````PowerShell\nImport-Module ./test.psmoduletemplate/                                                                \nGet-Command -Module test.psmoduletemplate       \n`````\n\n`````text\nCommandType     Name                                               Version    Source\n-----------     ----                                               -------    ------\nFunction        Get-PRETemplate                                    0.0.1      test.psmoduletemplate\n`````\n\n### Module-Settings.json\n\nThe settings-file will be created, if you build the module at the first time and contains the following properties:\n\n    ModuleName\n    ModuleVersion\n    ModuleDescription\n    ModuleAuthor\n    ModuleCompany\n    ModulePrefix\n    LastChange\n\n## Code\n\nIn this folder save all your functions as PS1-Files with the Name of the function you want to have in the Module. e.g. Get-PRETemplate.ps1.\n\n### Get-PRETemplate.ps1\n\nThis is an example function-file, you can copy and rename this file for your own use. Before you build your module, please be sure that you renamed the function name within the file.\n\n### Write-PRELog.ps1\n\nThis is an example Log-function to write information to the specified logfile. If no logfile is ommited, the default logfile will be used (\u003cModulePath\\ModuleName.log\u003e).\n\n## Module-Folder\n\nThe Module-Folder will be created automatically with the Build-Module.script.\n\n### Manifest-File\n\nAutomatically generated Manifest-file (PSD1), please update some settings by editing the file in vs-code.\n\n### Module-File\n\nPowerShell-Module-file (PSM1), contains all your functions from the Code-folder.\n\n## Tests\n\nThis folder contains all the Pester-Test-scripts.  \n\n### Functions.Tests.ps1\n\nFunctions.Tests.ps1 tests all of your scripts/functions in the folder Code.  \n\n### Failed.Tests.json\n\nThis file will be created, if there were some errors in the Build-Module.\n\n### Module.Tests.ps1\n\nThis is the file for your Function-Tests. Here you should write a test for each function to ensure, that your code is not damaged and is valid.\nYou can call this Tests in a GitHub-Action or CI/CD-Pipeline or simple manually.\n\n````PowerShell\n$TestsResult = Invoke-Pester -Script ./Tests/Module.Tests.ps1 -Output Detailed  -PassThru\n`````\n\n`````text\nDescribing Module Tests\n Context Import Module\n   [+] Import test.psmoduletemplate should not throw 8ms (5ms|3ms)\n   [+] Get-Command -Module test.psmoduletemplate should not throw 11ms (3ms|8ms)\n   [+] Get-Command -Module test.psmoduletemplate should return commands 10ms (8ms|1ms)\n Context Functions\n   [+] Get-PRETemplate should not throw 53ms (51ms|2ms)\n Context Remove Module\n   [+] Removes test.psmoduletemplate should not throw 8ms (6ms|2ms)\n   [+] Get-Module -Name test.psmoduletemplate should be NullOrEmpty 4ms (3ms|1ms)\nTests completed in 238ms\nTests Passed: 6, Failed: 0, Skipped: 0 NotRun: 0\n`````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinuwalther%2FPSModuleTemplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinuwalther%2FPSModuleTemplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinuwalther%2FPSModuleTemplate/lists"}