First step of turning the script collection into a PowerShell module. src/Elysium/ gets a manifest (Elysium.psd1, now the single source of the version) and a root module that dot-sources Private/ and Public/. The 23 helpers from Elysium.Common.ps1 move verbatim into src/Elysium/Private/, split by concern: Relaunch.ps1, Settings.ps1, Storage.ps1 (Azure SAS, storage paths, SigV4/S3, parallel helper injection) and AdPreflight.ps1. Nothing is exported yet. Elysium.Common.ps1 becomes a transitional loader: it reads the version from the manifest and dot-sources the Private files, so every root script that dot-sources it gets exactly the same functions in its own scope as before. No script changes in this commit. The module sets $ErrorActionPreference = 'Stop' itself: module functions resolve preference variables through the module scope, so the callers' setting would not reach the cmdlets added later. Verified on pwsh 7: Test-ModuleManifest passes; the module imports with all 23 functions visible in module scope (so Get-Command-based parallel helper injection keeps working once code moves in); a script dot-sourcing the loader sees the same version and helpers, and the relaunch still targets the calling script with its parameters; all .ps1 files parse.
8 lines
527 B
PowerShell
8 lines
527 B
PowerShell
# Transitional loader. The shared helpers now live in the Elysium module (src/Elysium/Private);
|
|
# root scripts that dot-source this file keep getting them in their own scope until each script
|
|
# is converted to a module cmdlet.
|
|
$script:ElysiumVersion = (Import-PowerShellDataFile -Path (Join-Path -Path $PSScriptRoot -ChildPath 'src/Elysium/Elysium.psd1')).ModuleVersion
|
|
foreach ($helperFile in Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath 'src/Elysium/Private') -Filter '*.ps1') {
|
|
. $helperFile.FullName
|
|
}
|