You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The structure of the ModuleTools module is meticulously designed according to PowerShell best practices for module development. While some design decisions may seem unconventional, they are made to ensure that ModuleTools and the process of building modules remain straightforward and easy to manage.
21
19
22
20
> [!IMPORTANT]
@@ -28,7 +26,7 @@ The structure of the ModuleTools module is meticulously designed according to Po
28
26
Install-Module -Name ModuleTools
29
27
```
30
28
31
-
> Note: ModuleTolls is still in early devleopment phase and lot of changes are expected. Please read through [ChangeLog](/CHANGELOG.md) for all updates.
29
+
> Note: ModuleTolls is still in early development phase and lot of changes are expected. Please read through [ChangeLog](/CHANGELOG.md) for all updates.
32
30
33
31
## 🧵 Design
34
32
@@ -70,10 +68,10 @@ Run `New-MTModule` to generate the scaffolding; this will also create the `proje
70
68
71
69
### Src Folder
72
70
73
-
- Place all your functions in the `private` and `public` folders within the `src` directory.
74
-
- All functions in the `public` folder are exported during the module build.
75
-
- All functions in the `private` folder are accessible internally within the module but are not exposed outside the module.
76
-
- Contents of the `src/resources` folder, including any subfolder, will included in the `dist` folder during the module build.
71
+
- Place all your functions in the `private` and `public` folders within the `src` directory.
72
+
- All functions in the `public` folder are exported during the module build.
73
+
- All functions in the `private` folder are accessible internally within the module but are not exposed outside the module.
74
+
- Contents of the `src/resources` folder, including any subfolder, will included in the `dist` folder during the module build.
77
75
78
76
#### resources Folder
79
77
@@ -87,11 +85,13 @@ The `resources` folder within the `src` directory is intended for including any
87
85
88
86
When the module is built, the contents of the `src/resources` folder will be copied directly to the `dist` folder. If the `src/resources` folder contains any subfolders, those subfolders and their contents will also be included in the `dist` folder, ensuring that all necessary files are available for the module to function correctly.
89
87
88
+
How the resources folder gets copied to the "OutputModuleDir" folder will depends on the "CopyMode" project setting. When missing or set to "Folder", the resources folder will be copied. When "CopyMode" is set to "Content", then only the content of the resources folder will be copied.
89
+
90
90
Leave `src\resources` empty if there is no need to include any additional content in the `dist` folder.
91
91
92
92
An example of the module build where resources were included:
93
93
94
-
```
94
+
```powershell
95
95
dist
96
96
└── TestModule
97
97
├── TestModule.psd1
@@ -127,6 +127,11 @@ New-MTModule ~/Work
127
127
128
128
`ModuleTools` is designed so that you don't need any additional tools like `make` or `psake` to run the build commands. There's no need to maintain complex `build.ps1` files or sample `.psd1` files. Simply follow the structure outlined above, and you can run `Invoke-MTBuild` to build the module. The output will be saved in the `dist` folder, ready for distribution.
129
129
130
+
The Invoke-MTBuild CmdLet includes a step where the resources folder and/or it's contents are copied to the "OutputModuleDir" folder. This is controlled by the optional "CopyMode" project setting.
131
+
132
+
If "CopyMode" = 'Folder or if it's missing, the entire resources folder gets copied to the "OutputModuleDir" folder.
133
+
If "CopyMode" = 'Content', only the content of the resources folder gets copied to the "OutputModuleDir" folder.
0 commit comments