Commit b849acd
📖 [Docs]: Module dependency declaration using #Requires -Modules now documented (#297)
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.
- Fixes #293
## 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:
```powershell
#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.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Co-authored-by: Marius Storhaug <marstor@hotmail.com>1 parent 2fb6675 commit b849acd
1 file changed
+37
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
| |||
94 | 99 | | |
95 | 100 | | |
96 | 101 | | |
| 102 | + | |
97 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
98 | 108 | | |
99 | 109 | | |
100 | 110 | | |
| |||
953 | 963 | | |
954 | 964 | | |
955 | 965 | | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
956 | 981 | | |
957 | 982 | | |
| 983 | + | |
| 984 | + | |
958 | 985 | | |
959 | 986 | | |
960 | 987 | | |
961 | 988 | | |
962 | 989 | | |
| 990 | + | |
| 991 | + | |
963 | 992 | | |
964 | 993 | | |
965 | 994 | | |
966 | 995 | | |
967 | 996 | | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
968 | 1005 | | |
969 | 1006 | | |
970 | 1007 | | |
| |||
0 commit comments