Skip to content

build.ps1 resolves repo root one directory too high — build produces 0 functions #2

Description

Summary

build.ps1 (repo root) fails to find Private/, Public/, and the .psd1 — it silently
builds a .psm1 with 0 private and 0 public functions and then errors copying the .psd1:

Building PureStorageFlashBladePowerShell...
  Private functions: 0
  Public functions:  0
  Generated <repoParent>\build\PureStorageFlashBladePowerShell\PureStorageFlashBladePowerShell.psm1 (27 lines)
Copy-Item: build.ps1:106
Line |
 106 |  Copy-Item -Path $psd1Source -Destination $OutputPath
     |  Cannot find path '<repoParent>\PureStorageFlashBladePowerShell.psd1' because it does not exist.

Root cause

Introduced in fc6d8de1 (v2.0.4). The path-resolution comment/logic assumes the script now
lives in <repo>/scripts/build.ps1 and walks up one directory to find the repo root:

https://github.com/dmann000/fb-powershell/blob/main/build.ps1#L18-L22

# This script lives in <repo>/scripts/; the source files (Public/, Private/, .psd1,
# .psm1, LICENSE) live in <repo>/. Resolve repoRoot one level up.
$scriptDir = if ($PSScriptRoot) { $PSScriptRoot } else { Split-Path -Parent $MyInvocation.MyCommand.Path }
if (-not $scriptDir) { $scriptDir = (Get-Location).Path }
$repoRoot = Split-Path -Parent $scriptDir

But build.ps1 was never actually moved into a scripts/ folder — it's still at repo root
alongside Public/, Private/, and the .psd1. So $repoRoot resolves to the parent of the
repo, one directory too high.

Repro

./build.ps1

from a clean checkout of main.

Suggested fix

Since the script is at repo root (not <repo>/scripts/), $repoRoot should just be
$scriptDir — see comment in the fix below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions