Skip to content

Commit 22526b5

Browse files
Refactor module path handling in main.ps1 to improve clarity and consistency
1 parent 4b2f08a commit 22526b5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

scripts/main.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ $testPath = Resolve-Path -Path "$PSScriptRoot/tests/$settings" | Select-Object -
1717
$localTestPath = Resolve-Path -Path 'tests' | Select-Object -ExpandProperty Path
1818
switch ($settings) {
1919
'Module' {
20-
$codePath = Resolve-Path -Path "outputs/module/$moduleName" | Select-Object -ExpandProperty Path
21-
$manifestFilePath = Join-Path -Path $codePath "$moduleName.psd1"
20+
$modulePath = Resolve-Path -Path "outputs/module/$moduleName" | Select-Object -ExpandProperty Path
21+
$manifestFilePath = Join-Path -Path $modulePath "$moduleName.psd1"
2222
Write-Verbose " - Manifest file path: [$manifestFilePath]" -Verbose
2323
Resolve-PSModuleDependency -ManifestFilePath $manifestFilePath
2424
$PSModulePath = $env:PSModulePath -split [System.IO.Path]::PathSeparator | Select-Object -First 1
25-
$moduleInstallPath = New-Item -Path "$PSModulePath/$moduleName/999.0.0" -ItemType Directory -Force
26-
Copy-Item -Path $codePath -Destination $moduleInstallPath -Recurse -Force
27-
Get-ChildItem -Path $moduleInstallPath -Recurse | Select-Object FullName | Out-String
25+
$codePath = New-Item -Path "$PSModulePath/$moduleName/999.0.0" -ItemType Directory -Force
26+
Copy-Item -Path $codePath -Destination $codePath -Recurse -Force
27+
Get-ChildItem -Path $codePath -Recurse | Select-Object FullName | Out-String
2828
Import-Module -Name $moduleName -Verbose
2929
}
3030
'SourceCode' {
@@ -38,12 +38,12 @@ switch ($settings) {
3838
[pscustomobject]@{
3939
ModuleName = $moduleName
4040
Settings = $settings
41-
CodePath = $moduleInstallPath
41+
CodePath = $codePath
4242
LocalTestPath = $localTestPath
4343
TestPath = $testPath
4444
} | Format-List | Out-String
4545

4646
Set-GitHubOutput -Name ModuleName -Value $moduleName
47-
Set-GitHubOutput -Name CodePath -Value $moduleInstallPath
47+
Set-GitHubOutput -Name CodePath -Value $codePath
4848
Set-GitHubOutput -Name LocalTestPath -Value $localTestPath
4949
Set-GitHubOutput -Name TestPath -Value $testPath

0 commit comments

Comments
 (0)