diff --git a/build/funcs/Import-PSGalleryModuleNested.ps1 b/build/funcs/Import-PSGalleryModuleNested.ps1 index bd33680..b515540 100644 --- a/build/funcs/Import-PSGalleryModuleNested.ps1 +++ b/build/funcs/Import-PSGalleryModuleNested.ps1 @@ -1,3 +1,6 @@ +#!/usr/bin/env pwsh +$ErrorActionPreference = "Stop" +Set-StrictMode -Version Latest function Import-PSGalleryModuleNested { @@ -21,6 +24,7 @@ function Import-PSGalleryModuleNested { [Parameter(Mandatory = $false)] [switch] $SkipAlreadyLoaded ) + [string] $ds = [System.IO.Path]::DirectorySeparatorChar [PSModuleInfo[]] $modulesLoaded = @() if ($id -and $version) { if ($SkipAlreadyLoaded -and (Get-Module -Name $id -ErrorAction SilentlyContinue)) { @@ -47,7 +51,6 @@ function Import-PSGalleryModuleNested { throw "Either or both of '-RuntimeDependencies' and '-DevelopmentDependencies' must be specified when not loading a specific individual module." } - [string] $ds = [System.IO.Path]::DirectorySeparatorChar [string] $projectRoot = Resolve-Path -Path "$PSScriptRoot${ds}..${ds}.." if (-not (Test-Path "${projectRoot}${ds}lib" -PathType Container -ErrorAction SilentlyContinue)) { throw "Could not find folder 'lib' at '$projectRoot'. Did you forget to 'restore'?" diff --git a/build/lint.ps1 b/build/lint.ps1 index ab09792..6b3665a 100644 --- a/build/lint.ps1 +++ b/build/lint.ps1 @@ -6,13 +6,13 @@ $ErrorActionPreference = "Stop" Set-StrictMode -Version Latest +[string] $ds = [System.IO.Path]::DirectorySeparatorChar . "${PSScriptRoot}${ds}funcs${ds}Import-PSGalleryModuleNested.ps1" Import-PSGalleryModuleNested -id 'PSScriptAnalyzer' -SkipAlreadyLoaded | Out-Null if (-not (Get-Command Invoke-ScriptAnalyzer -ErrorAction SilentlyContinue)) { throw "Invoke-ScriptAnalyzer not found. Please ensure that PowerShell module 'PSScriptAnalyzer' is configured as a development dependency." } -$ds = [System.IO.Path]::DirectorySeparatorChar Invoke-ScriptAnalyzer -Path "${PSScriptRoot}${ds}..${ds}src${ds}**${ds}*" -Recurse -ReportSummary -OutVariable issues $errors = $issues.Where({$_.Severity -eq 'Error'}) $warnings = $issues.Where({$_.Severity -eq 'Warning'}) diff --git a/build/package-dev.ps1 b/build/package-dev.ps1 index 66355e5..1ad0d21 100644 --- a/build/package-dev.ps1 +++ b/build/package-dev.ps1 @@ -33,7 +33,7 @@ if (-not $PackageVersionPrereleaseTag) { $PackageVersionPrereleaseTag = "dev-" + $PackageVersionPrereleaseTag } -$ds = [System.IO.Path]::DirectorySeparatorChar +[string] $ds = [System.IO.Path]::DirectorySeparatorChar & "${PSScriptRoot}${ds}package.ps1" ` -PackageVersionNuGet $PackageVersionNuGet ` -PackageVersionMajorMinorPatchBuild $PackageVersionMajorMinorPatchBuild ` diff --git a/build/package.ps1 b/build/package.ps1 index 078b882..00b8626 100644 --- a/build/package.ps1 +++ b/build/package.ps1 @@ -24,8 +24,8 @@ $ErrorActionPreference = "Stop" Set-StrictMode -Version Latest -& "${PSScriptRoot}${ds}restore.ps1" [string] $ds = [System.IO.Path]::DirectorySeparatorChar +& "${PSScriptRoot}${ds}restore.ps1" [string[]] $authors = @( "Pwshrc Maintainers" )