@@ -120,280 +120,29 @@ YourModuleName/
120120
121121## Customizing Your Module
122122
123- ### 1. Update Module Manifest
123+ Quick tweaks to make the template yours. For everything beyond setup, use the Development guide.
124124
125- Edit ` src/YourModuleName.psd1 ` :
125+ ### Minimal Customization
126126
127- ``` powershell
128- @{
129- # Update these fields:
130- Author = 'Your Name'
131- CompanyName = 'Your Company'
132- Copyright = '(c) 2026 Your Name. All rights reserved.'
133- Description = 'Detailed description of what your module does'
134-
135- # Add relevant tags for PowerShell Gallery
136- PrivateData = @{
137- PSData = @{
138- Tags = @('PowerShell', 'Automation', 'DevOps')
139- }
140- }
141-
142- # Set your project URLs
143- PrivateData = @{
144- PSData = @{
145- ProjectUri = 'https://github.com/YourUsername/YourModuleName'
146- LicenseUri = 'https://github.com/YourUsername/YourModuleName/blob/main/LICENSE'
147- }
148- }
149-
150- # Module version (auto-updated by GitVersion)
151- ModuleVersion = '0.1.0'
152-
153- # Functions to export (update as you add functions)
154- FunctionsToExport = @('Get-PSScriptModuleInfo')
155- }
156- ```
157-
158- ### 2. Update README Badges
159-
160- In ` README.md ` , replace badge URLs:
161-
162- ``` markdown
163- # Change this:
164- [ ![ CI] ( https://github.com/WarehouseFinds/PSScriptModule/... )]
165-
166- # To this:
167- [ ![ CI] ( https://github.com/YourUsername/YourModuleName/... )]
168- ```
169-
170- ### 3. Review License
171-
172- Update ` LICENSE ` file with your preferred license and copyright information.
173-
174- ### 4. Customize CONTRIBUTING.md
175-
176- Update contribution guidelines to match your project's needs.
177-
178- ## Quick Start Commands
179-
180- ``` powershell
181- # Build the module
182- Invoke-Build # Clean + Build (default)
183- Invoke-Build Build # Build only
184-
185- # Run tests
186- Invoke-Build Test # Run all tests
187- Invoke-Build UnitTests # Unit tests only
188-
189- # Code quality
190- Invoke-Build PSScriptAnalyzer # Static analysis
191- Invoke-Build InjectionHunter # Security scan
192- # Generate documentation
193- Invoke-Build Export-CommandHelp # Create help files
194-
195- # Clean up
196- Invoke-Build Clean # Remove build artifacts
197- ```
198-
199- ## Your First Function
200-
201- Let's create a simple function:
202-
203- ### 1. Create Function File
204-
205- Create ` src/Public/Get-Greeting.ps1 ` :
206-
207- ``` powershell
208- function Get-Greeting {
209- <#
210- .SYNOPSIS
211- Returns a greeting message
212-
213- .DESCRIPTION
214- Generates a personalized greeting message for the specified name.
215-
216- .PARAMETER Name
217- The name to include in the greeting
218-
219- .EXAMPLE
220- Get-Greeting -Name 'World'
221- Returns: "Hello, World!"
222-
223- .OUTPUTS
224- System.String
225- #>
226- [CmdletBinding()]
227- param (
228- [Parameter(Mandatory)]
229- [ValidateNotNullOrEmpty()]
230- [string]
231- $Name
232- )
233-
234- Write-Verbose "Generating greeting for: $Name"
235- return "Hello, $Name!"
236- }
237- ```
238-
239- ### 2. Create Test File
240-
241- Create ` src/Public/Get-Greeting.Tests.ps1 ` :
242-
243- ``` powershell
244- BeforeAll {
245- # Import the function being tested
246- . $PSCommandPath.Replace('.Tests.ps1', '.ps1')
247- }
248-
249- Describe 'Get-Greeting' {
250- Context 'Parameter Validation' {
251- It 'Should require Name parameter' {
252- { Get-Greeting } | Should -Throw
253- }
254-
255- It 'Should not accept null or empty Name' {
256- { Get-Greeting -Name '' } | Should -Throw
257- { Get-Greeting -Name $null } | Should -Throw
258- }
259- }
260-
261- Context 'Functionality' {
262- It 'Should return greeting with provided name' {
263- $result = Get-Greeting -Name 'PowerShell'
264- $result | Should -Be 'Hello, PowerShell!'
265- }
266-
267- It 'Should return string type' {
268- $result = Get-Greeting -Name 'Test'
269- $result | Should -BeOfType [string]
270- }
271- }
272- }
273- ```
274-
275- ### 3. Update Module Manifest
276-
277- Add your function to exports in ` src/YourModuleName.psd1 ` :
278-
279- ``` powershell
280- FunctionsToExport = @('Get-PSScriptModuleInfo', 'Get-Greeting')
281-
282- # Or use wildcard to export all Public functions:
283- FunctionsToExport = '*'
284- ```
127+ - Update manifest metadata in ` src/YourModuleName.psd1 ` (Author, CompanyName, Description, ProjectUri, LicenseUri, tags).
128+ - Adjust badges and links in ` README.md ` .
129+ - Review ` LICENSE ` and ` CONTRIBUTING.md ` to match your project.
285130
286- ### 4. Build and Test
131+ ## Quick Checks
287132
288133``` powershell
289- # Build the module
134+ # Build once to verify toolchain
290135Invoke-Build
291136
292- # Run tests
137+ # (Optional) run tests
293138Invoke-Build Test
294-
295- # Test your function
296- Import-Module ./build/out/YourModuleName/YourModuleName.psd1 -Force
297- Get-Greeting -Name 'PowerShell'
298- ```
299-
300- ## Development Workflow
301-
302- ### Daily Development
303-
304- ``` powershell
305- # 1. Pull latest changes
306- git pull origin main
307-
308- # 2. Create feature branch
309- git checkout -b feature/my-new-feature
310-
311- # 3. Make your changes
312- # - Add/modify functions in src/Public/ or src/Private/
313- # - Add/update corresponding .Tests.ps1 files
314- # - Update help documentation if needed
315-
316- # 4. Run tests frequently
317- Invoke-Build Test
318-
319- # 5. Commit with semantic versioning keyword
320- git commit -m "Add new feature +semver: minor"
321-
322- # 6. Push and create Pull Request
323- git push origin feature/my-new-feature
324- ```
325-
326- ### Version Control Keywords
327-
328- Include these in commit messages to control version bumps:
329-
330- - ` +semver: major ` - Breaking changes (1.0.0 → 2.0.0)
331- - ` +semver: minor ` - New features (1.0.0 → 1.1.0)
332- - ` +semver: patch ` - Bug fixes (1.0.0 → 1.0.1)
333- - ` +semver: none ` - No version change (documentation only)
334-
335- ## Troubleshooting
336-
337- ### Build Failures
338-
339- ** Problem** : ` Invoke-Build ` not found
340-
341- ``` powershell
342- # Solution: Install InvokeBuild
343- Install-Module -Name InvokeBuild -Scope CurrentUser -Force
344- ```
345-
346- ** Problem** : Module dependencies not found
347-
348- ``` powershell
349- # Solution: Reinstall dependencies
350- Invoke-PSDepend -Path ./requirements.psd1 -Install -Import -Force
351- ```
352-
353- ### Test Failures
354-
355- ** Problem** : Pester version conflicts
356-
357- ``` powershell
358- # Solution: Install correct Pester version
359- Install-Module -Name Pester -RequiredVersion 5.7.1 -Force -SkipPublisherCheck
360- ```
361-
362- ** Problem** : Tests can't find functions
363-
364- ``` powershell
365- # Solution: Ensure dot-sourcing is correct in test file
366- BeforeAll {
367- . $PSCommandPath.Replace('.Tests.ps1', '.ps1')
368- }
369- ```
370-
371- ### Import Issues
372-
373- ** Problem** : Module doesn't import after building
374-
375- ``` powershell
376- # Solution: Verify module manifest is valid
377- Test-ModuleManifest ./build/out/YourModuleName/YourModuleName.psd1
378-
379- # Check for errors
380- Import-Module ./build/out/YourModuleName/YourModuleName.psd1 -Verbose
381- ```
382-
383- ** Problem** : Functions not exported
384-
385- ``` powershell
386- # Solution: Check FunctionsToExport in manifest
387- # Either list functions explicitly or use '*' for all Public functions
388139```
389140
390141## Next Steps
391142
392- Now that you're set up, learn more about:
393-
394- - 📖 [ Development Workflow] ( development.md ) - Building, testing, and documentation
395- - 🔄 [ CI/CD & Publishing] ( ci-cd.md ) - Automated releases and PowerShell Gallery publishing
396- - 🤖 [ AGENTS.md] ( ../AGENTS.md ) - Guidelines for AI coding assistants
143+ - 📖 Development workflow, function patterns, and tests: [ development.md] ( development.md )
144+ - 🔄 CI/CD and publishing: [ ci-cd.md] ( ci-cd.md )
145+ - 🤖 AI contributor guidance: [ AGENTS.md] ( ../AGENTS.md )
397146
398147## Additional Resources
399148
0 commit comments