Module manifests
The script modules we’ve been playing with so far are monolithic single files, either standalone or nested. That’s fine for hobbyist use, but it’s not great in a production environment, where we might want to split our functions into separate files and include version information and a whole bunch of other metadata and resources, such as XML formatting files or binaries. To organize a more complex module, we need a document that explains how it is to be loaded and implemented; this document is called a module manifest, and it is a hash table saved with a .psd1
extension. Let’s have a look at an example. if we browse to the PowerShellGet module in C:\Program Files\PowerShell\7\Modules
(or /opt/microsoft/PowerShell/7/Modules
in Linux), we will see the following files and folders:
Figure 11.14 – The PowerShellGet module
As we can see, there are four files and three folders. These folders contain several...