A couple years ago I wrote a PowerShell module starter kit (here). The goal was to provide an example for organizing a module using best practices and provide a live repository you could clone and play around with.
I’ve taken that starter kit module and updated it for 2019. Incorporating some new best practices and new usage patterns that I find helpful. Head over to the GitHub link to check it out!
What’s new in this release?
- Added examples to store and reference module-scoped constants.
- Added examples to read/write to a module-scoped cache (to store data across function calls).
- Added examples for exporting V5 classes to use outside of module scope.
- Added examples for packaging and referencing non-PowerShell module file resources (things like .json documents).
- Added examples for referencing and using external libraries (ex: Newtonsoft.JSON).
- Switched unit tests to use InModuleScope for private function testing.
- Switched unit tests to use module loading by name, instead of module manifest relative path.
- Updated documentation for how to load the module and run the unit tests.
- Reorganized project folder structure (particularly around tests).