psake / psake/PowerShellBuild

Staging flattens a culture directory's .psd1 into the output root

Offen Anfängerfreundlich
#211 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug
Vorherrschende Sprache
PowerShell
Sterne
145
Forks
27
Ø Merge
10 Std. 16 Min.
Gemergte PRs (30 T.)
34

Beschreibung

Found while researching #207. Reading the code confirms it; it is also visible in that issue's own reproduction output.

What happens

Build-PSBuildModule stages the module's loose files with:

$getChildItemSplat = @{
    Path    = $Path
    Include = "*.psm1", "*.psd1", "*.ps1xml"
    Depth   = 1
}
Get-ChildItem @getChildItemSplat |
    Copy-Item -Destination $DestinationPath -Force

-Depth 1 implies recursion one level down, so this matches en-US/Messages.psd1 — and Copy-Item -Destination $DestinationPath writes it flat into the output root, discarding the directory it came from.

A module with a localized Messages.psd1 therefore builds an output containing a stray Messages.psd1 at the root that nothing reads. If CopyDirectories also names en-US, the correct copy is there too, and the built tree carries both.

Why it matters, mildly

Nothing breaks. Import-LocalizedData resolves through the culture directory and ignores the stray file, and a module without a culture directory never hits it. The costs are that the published package carries a file that serves no purpose and misleads anyone reading the tree, and that a consumer debugging localization finds two copies of the same file and has to work out which one is live.

It is also the same root cause as #210, seen from the other side: the depth-1 glob is trying to serve two purposes — collect the root manifest and module file, and leave everything else to CopyDirectories — and reaches one level too far.

Options

  1. Drop -Depth 1, so the glob matches only the root. The manifest and root module are always at the root, so nothing intended is lost. Anything deeper is CopyDirectories' job. Smallest change.
  2. Preserve relative paths when copying, so en-US/Messages.psd1 lands at en-US/Messages.psd1. More faithful, and it would partly address #210 — but it makes the glob a second, implicit staging mechanism competing with CopyDirectories, which is how the two got tangled in the first place.
  3. Leave it. The stray file is inert.

(1) looks right, and it is a one-word deletion. But -Depth 1 was presumably added deliberately at some point, and I could not find what for — worth a moment's thought before removing it, in case some layout depends on it.

Related: #206, #207 and #210 are all in this same staging logic. Worth deciding together.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der im Issue beschriebenen Staging-Logik von Build-PSBuildModule und prüfe die verwandten Issues #206, #207 und #210, bevor du das Verhalten von depth änderst. Verifiziere, dass das Root-Manifest und die Moduldateien weiterhin korrekt gestaged werden, während eine lokalisierte en-US/Messages.psd1 nicht in das Output-Root kopiert wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
powershell
Bereich
build-system
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
74/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.