Skip to content

Commit b36d9b2

Browse files
Merge pull request #2 from theohbrothers/enhancement/module-simplify-script-module-file
Enhancement (module): Simplify script module file
2 parents 69e853f + 3ca00e0 commit b36d9b2

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
Set-StrictMode -Version Latest
22

3-
##################
4-
# Module globals #
5-
##################
3+
# Initialize variables
4+
$MODULE_BASE_DIR = $PSScriptRoot
5+
$MODULE_PUBLIC_DIR = Join-Path $MODULE_BASE_DIR 'Public'
66

7-
# Module constants
8-
$script:MODULE = @{}
9-
$script:MODULE['BASE_DIR'] = $PSScriptRoot
10-
$script:MODULE['PUBLIC_DIR'] = Join-Path $script:MODULE['BASE_DIR'] 'Public' # Module public functions
7+
# Load functions
8+
Get-ChildItem "$MODULE_PUBLIC_DIR\*.ps1" -exclude *.Tests.ps1 | % { . $_.FullName }
119

12-
# Load vendor, Public, Private, classes, helpers
13-
Get-ChildItem -Path "$($script:MODULE['PUBLIC_DIR'])\*.ps1" | % { . $_.FullName }
14-
15-
# Export Public functions
16-
Export-ModuleMember -Function (Get-ChildItem "$($script:MODULE['PUBLIC_DIR'])\*.ps1" | Select-Object -ExpandProperty BaseName)
10+
# Export functions
11+
Export-ModuleMember -Function (Get-ChildItem "$MODULE_PUBLIC_DIR\*.ps1" | Select-Object -ExpandProperty BaseName)

0 commit comments

Comments
 (0)