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
Copy file name to clipboardExpand all lines: templates/PSFModule/internal/configurations/configuration.ps1
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -9,4 +9,7 @@ feel totally free to split them into multiple files.
9
9
<#
10
10
# Example Configuration
11
11
Set-PSFConfig -Module 'þnameþ' -Name 'Example.Setting' -Value 10 -Initialize -Validation 'integer' -Handler { } -Description "Example configuration setting. Your module can then use the setting using 'Get-PSFConfigValue'"
12
-
#>
12
+
#>
13
+
14
+
Set-PSFConfig-Module 'þnameþ'-Name 'Import.DoDotSource'-Value $false-Initialize -Validation 'bool'-Description "Whether the module files should be dotsourced on import. By default, the files of this module are read as string value and invoked, which is faster but worse on debugging."
15
+
Set-PSFConfig-Module 'þnameþ'-Name 'Import.IndividualFiles'-Value $false-Initialize -Validation 'bool'-Description "Whether the module files should be imported individually. During the module build, all module code is compiled into few files, which are imported instead by default. Loading the compiled versions is faster, using the individual files is easier for debugging and testing out adjustments."
This is a finished module layout optimized for implementing the PSFramework.
4
+
5
+
If you don't care to deal with the details, this is what you need to do to get started seeing results:
6
+
7
+
- Add the functions you want to publish to `/functions/`
8
+
- Update the `FunctionsToExport` node in the module manifest (þnameþ.psd1). All functions you want to publish should be in a list.
9
+
- Add internal helper functions the user should not see to `/internal/functions/`
10
+
11
+
## Path Warning
12
+
13
+
> If you want your module to be compatible with Linux and MacOS, keep in mind that those OS are case sensitive for paths and files.
14
+
15
+
`Import-ModuleFile` is preconfigured to resolve the path of the files specified, so it will reliably convert weird path notations the system can't handle.
16
+
Content imported through that command thus need not mind the path separator.
17
+
If you want to make sure your code too will survive OS-specific path notations, get used to using `Resolve-path` or the more powerful `Resolve-PSFPath`.
0 commit comments