Skip to content

Commit

Permalink
🐛 Fixes Misplaced Build Script Variable Declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
brucificus committed Aug 25, 2023
1 parent eb83639 commit 6ab1642
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion build/funcs/Import-PSGalleryModuleNested.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/usr/bin/env pwsh
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest


function Import-PSGalleryModuleNested {
Expand All @@ -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)) {
Expand All @@ -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'?"
Expand Down
2 changes: 1 addition & 1 deletion build/lint.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'})
Expand Down
2 changes: 1 addition & 1 deletion build/package-dev.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 `
Expand Down
2 changes: 1 addition & 1 deletion build/package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down

0 comments on commit 6ab1642

Please sign in to comment.