Skip to content

Commit 245e547

Browse files
Refactor module installation process in main.ps1 to use PSModulePath for directory management
1 parent addd28f commit 245e547

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

scripts/main.ps1

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,12 @@ $localTestPath = Resolve-Path -Path 'tests' | Select-Object -ExpandProperty Path
1818
switch ($settings) {
1919
'Module' {
2020
$codePath = Resolve-Path -Path "outputs/module/$moduleName" | Select-Object -ExpandProperty Path
21-
$localRepo = @{
22-
Name = 'Local'
23-
Uri = New-Item -Path $PSScriptRoot -Name '.localpsmodulerepo' -ItemType Directory
24-
Trusted = $true
25-
Priority = 100
26-
}
27-
Register-PSResourceRepository @localRepo
28-
Get-PSResourceRepository | Format-List | Out-String
2921
$manifestFilePath = Join-Path -Path $codePath "$moduleName.psd1"
3022
Write-Verbose " - Manifest file path: [$manifestFilePath]" -Verbose
3123
Resolve-PSModuleDependency -ManifestFilePath $manifestFilePath
32-
Publish-PSResource -Path $codePath -Repository Local
33-
Install-PSResource -Name $moduleName -Repository Local
24+
$PSModulePath = $env:PSModulePath -split [System.IO.Path]::PathSeparator | Select-Object -First 1
25+
New-Item -Path "$PSModulePath/$moduleName/999.0.0" -ItemType Directory -Name "" -Force
26+
Copy-Item -Path $codePath -Destination "$PSModulePath/$moduleName/999.0.0" -Recurse -Force
3427
}
3528
'SourceCode' {
3629
$codePath = Resolve-Path -Path 'src' | Select-Object -ExpandProperty Path

0 commit comments

Comments
 (0)