Skip to content

Comments

Publish-PSResource: honor ExternalModuleDependencies from PrivateData.PSData during dependency validation#1948

Open
PrzemyslawKlys wants to merge 1 commit intoPowerShell:masterfrom
PrzemyslawKlys:master
Open

Publish-PSResource: honor ExternalModuleDependencies from PrivateData.PSData during dependency validation#1948
PrzemyslawKlys wants to merge 1 commit intoPowerShell:masterfrom
PrzemyslawKlys:master

Conversation

@PrzemyslawKlys
Copy link

Summary

Fix Publish-PSResource dependency validation so ExternalModuleDependencies are respected for module manifests when declared under PrivateData.PSData.

Problem

Publish-PSResource excluded external dependencies only when ExternalModuleDependencies was present at the top level of parsed metadata.
For module manifests, this value is typically stored under PrivateData.PSData.ExternalModuleDependencies, so the dependency check could still fail and incorrectly require
-SkipDependenciesCheck.

Root Cause

ParseRequiredModules() only looked at:

  • parsedMetadataHash["ExternalModuleDependencies"]

and did not also inspect:

  • parsedMetadataHash["PrivateData"]["PSData"]["ExternalModuleDependencies"]

Also, dependency key matching was case-sensitive.

Changes

  • Updated ParseRequiredModules() in src/code/PublishHelper.cs to:
    • read external module dependencies from both top-level metadata and PrivateData.PSData
    • use robust nested hashtable extraction
    • normalize matching via case-insensitive dependency map keys
  • Added regression test in:
    • test/PublishPSResourceTests/PublishPSResource.Tests.ps1
    • test name: Publish a module with ExternalModuleDependencies that are not published

Validation

  • Added publish regression test covering module manifest external dependency behavior.

…ependency checks

- Read ExternalModuleDependencies from both top-level metadata and PrivateData.PSData

- Normalize dependency lookup to case-insensitive hashtable keys

- Add publish regression test for module manifests with external dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant