Skip to content

📖 [Docs]: Module dependency declaration using #Requires -Modules now documented#297

Open
Copilot wants to merge 3 commits intomainfrom
copilot/add-documentation-requires-statements
Open

📖 [Docs]: Module dependency declaration using #Requires -Modules now documented#297
Copilot wants to merge 3 commits intomainfrom
copilot/add-documentation-requires-statements

Conversation

Copy link
Contributor

Copilot AI commented Mar 13, 2026

The README now documents how to declare module dependencies using #Requires -Modules statements in individual function files. Developers who previously added RequiredModules to src/manifest.psd1 — only to have those entries silently dropped during the build — can now find clear guidance on the correct approach.

New: Module dependency documentation

A new "Declaring module dependencies" subsection under "Module source code structure" explains:

  • That dependencies are declared using #Requires -Modules at the top of individual function files (in src/functions/public/ and src/functions/private/)
  • The build aggregates all #Requires -Modules statements across source files into the RequiredModules field of the built manifest
  • Both bare-name and hashtable syntax variants are supported:
#Requires -Modules Microsoft.Graph.Authentication
#Requires -Modules @{ ModuleName = 'Microsoft.Graph.Authentication'; ModuleVersion = '2.28.0' }

An [!IMPORTANT] callout explicitly warns that adding RequiredModules to src/manifest.psd1 is silently ignored by the build — dependencies must use #Requires -Modules instead.

New: Co-location principle

A new entry in the "Principles and practices" section explains why dependency declarations belong in each function file rather than a central manifest, and how this prevents silent drift between the manifest and the actual code.

…ires statements

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Copilot AI changed the title [WIP] Add documentation for defining module dependencies using #Requires statements docs: Add documentation for declaring module dependencies via #Requires -Modules Mar 13, 2026
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot Please review comments.

…aintainability principle

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds missing documentation to the README explaining how to declare module dependencies using #Requires -Modules statements in function files, addressing a gap where developers were unknowingly adding RequiredModules to src/manifest.psd1 only to have those entries silently dropped during the build.

Changes:

  • Added a new "Declaring module dependencies" subsection under "Module source code structure" explaining the #Requires -Modules mechanism and the build aggregation behavior
  • Added a co-location maintainability principle to the "Principles and practices" section

You can also share your feedback on Copilot code review. Take the survey.

@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title docs: Add documentation for declaring module dependencies via #Requires -Modules 📖 [Docs]: Module dependency declaration using #Requires -Modules now documented Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add documentation for defining module dependencies using #Requires statements

3 participants