Skip to content

Commit b458d50

Browse files
Merge pull request #110 from WarehouseFinds/feat/documentation_update
Add Code of Conduct, update documentation, and enhance CI/CD pipeline details
2 parents 684865b + 7c6a70e commit b458d50

File tree

13 files changed

+434
-433
lines changed

13 files changed

+434
-433
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics,
6+
gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
7+
8+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
9+
10+
## Our Standards
11+
12+
Examples of behavior that contributes to a positive environment for our community include:
13+
14+
* Demonstrating empathy and kindness toward other people
15+
* Being respectful of differing opinions, viewpoints, and experiences
16+
* Giving and gracefully accepting constructive feedback
17+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
18+
* Focusing on what is best not just for us as individuals, but for the overall community
19+
20+
Examples of unacceptable behavior include:
21+
22+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
23+
* Trolling, insulting or derogatory comments, and personal or political attacks
24+
* Public or private harassment
25+
* Publishing others' private information, such as a physical or email address, without their explicit permission
26+
* Other conduct which could reasonably be considered inappropriate in a professional setting
27+
28+
## Enforcement Responsibilities
29+
30+
Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate,
31+
threatening, offensive, or harmful.
32+
33+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code.

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Contributing to PSScriptModule.Template
1+
# Contributing to PSScriptModule
22

3-
Thank you for your interest in contributing to PSScriptModule.Template! This document provides guidelines and instructions for contributing to this project.
3+
Thank you for your interest in contributing to PSScriptModule! This document provides guidelines and instructions for contributing to this project.
44

55
## Code of Conduct
66

README.md

Lines changed: 117 additions & 431 deletions
Large diffs are not rendered by default.

docs/building.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# 🔧 Build Tasks
2+
3+
The template includes several pre-configured build tasks:
4+
5+
```powershell
6+
# Clean + Build (default)
7+
Invoke-Build
8+
9+
# Individual tasks
10+
Invoke-Build Clean # Remove build artifacts
11+
Invoke-Build Build # Build the module
12+
Invoke-Build Test # Run all tests
13+
Invoke-Build Invoke-PSScriptAnalyzer # Run static code analysis
14+
Invoke-Build Invoke-InjectionHunter # Run security scans
15+
Invoke-Build Invoke-UnitTests # Run Pester tests with coverage
16+
Invoke-Build Export-CommandHelp # Generate documentation
17+
Invoke-Build Publish # Publish to PowerShell Gallery
18+
19+
# Build for different configurations
20+
Invoke-Build -ReleaseType Debug # Development build
21+
Invoke-Build -ReleaseType Release # Production build
22+
Invoke-Build -ReleaseType Prerelease # Pre-release build
23+
```

docs/ci-cd.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# 🔄 CI/CD Pipeline
2+
3+
The template includes a comprehensive CI/CD pipeline that runs automatically on pull requests and pushes to main.
4+
5+
## Pipeline Structure
6+
7+
The CI workflow orchestrates multiple jobs in parallel:
8+
9+
1. **Setup** - Caches PowerShell module dependencies for faster builds
10+
1. **Unit Tests** - Runs Pester tests with code coverage reporting
11+
1. **Static Code Analysis** - Validates code with PSScriptAnalyzer rules
12+
1. **Code Injection Analysis** - Scans for injection vulnerabilities with InjectionHunter
13+
1. **Semantic Code Analysis** - Runs CodeQL security analysis
14+
1. **Build** - Compiles module, generates help, creates releases, and publishes to PowerShell Gallery
15+
16+
### Workflow Triggers
17+
18+
- **Pull Request**: Runs all quality gates (tests not run for workflow-only changes)
19+
- **Push to main**: Runs full pipeline and creates prerelease
20+
- **Workflow Dispatch**: Manual trigger with custom version and publish options
21+
- **Schedule**: Weekly CodeQL security scan
22+
23+
## Build Types
24+
25+
The pipeline automatically determines the build type:
26+
27+
| Event | Build Type | Version Format | Published |
28+
| --------- | ---------------- | --------- |
29+
| Pull Request | Debug | `1.2.3-PullRequest1234` | No |
30+
| Push to main | Prerelease | `1.2.3-Prerelease` | Yes |
31+
| Manual (workflow_dispatch) | Release | `1.2.3` | Optional |
32+
33+
## 🔄 Versioning Strategy
34+
35+
This template uses **Semantic Versioning** (SemVer) with automated version management through GitVersion.
36+
37+
### GitVersion Configuration
38+
39+
- **Workflow**: GitHub Flow (main branch + feature branches)
40+
- **Strategy**: Every PR merge to `main` creates a new release
41+
- **Version calculation**: Based on commit history and tags
42+
43+
### Controlling Version Bumps
44+
45+
Include one of these keywords in your commit message:
46+
47+
| Keyword | Version Change | Example |
48+
| --------- | ---------------- | --------- |
49+
| `+semver: breaking` or `+semver: major` | Major (1.0.0 → 2.0.0) | Breaking changes |
50+
| `+semver: feature` or `+semver: minor` | Minor (1.0.0 → 1.1.0) | New features |
51+
| `+semver: fix` or `+semver: patch` | Patch (1.0.0 → 1.0.1) | Bug fixes |
52+
| `+semver: none` or `+semver: skip` | No change | Documentation updates |
53+
54+
### Example Commit Messages
55+
56+
```bash
57+
git commit -m "Add new Get-Something function +semver: minor"
58+
git commit -m "Fix parameter validation bug +semver: patch"
59+
git commit -m "Remove deprecated function +semver: breaking"
60+
git commit -m "Update README +semver: none"
61+
```

docs/dependencies.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# 📋 Dependencies
2+
3+
This template uses the following PowerShell modules:
4+
5+
| Module | Version | Purpose |
6+
| --------- | ---------------- | --------- |
7+
| **InvokeBuild** | 5.14.22 | Build orchestration |
8+
| **ModuleBuilder** | 3.1.8 | Module compilation |
9+
| **Pester** | 5.7.1 | Testing framework |
10+
| **PSScriptAnalyzer** | 1.24.0 | Static code analysis |
11+
| **InjectionHunter** | 1.0.0 | Security vulnerability scanning |
12+
| **Microsoft.PowerShell.PlatyPS** | 1.0.1 | Help documentation generation |
13+
14+
All dependencies are managed through `requirements.psd1` and can be installed with PSDepend.

docs/development.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# 🛠️ Development Workflow
2+
3+
## Creating New Functions
4+
5+
1. **Create function file** in `src/Public/` or `src/Private/`:
6+
7+
```powershell
8+
# src/Public/Get-Something.ps1
9+
function Get-Something {
10+
<#
11+
.SYNOPSIS
12+
Brief description
13+
14+
.DESCRIPTION
15+
Detailed description
16+
17+
.PARAMETER Name
18+
Parameter description
19+
20+
.EXAMPLE
21+
Get-Something -Name 'Example'
22+
Description of example
23+
#>
24+
[CmdletBinding()]
25+
param (
26+
[Parameter(Mandatory)]
27+
[string]$Name
28+
)
29+
30+
# Implementation
31+
}
32+
```
33+
34+
1. **Create test file** alongside function:
35+
36+
```powershell
37+
# src/Public/Get-Something.Tests.ps1
38+
BeforeAll {
39+
. $PSCommandPath.Replace('.Tests.ps1', '.ps1')
40+
}
41+
42+
Describe 'Get-Something' {
43+
It 'Should return expected result' {
44+
$result = Get-Something -Name 'test'
45+
$result | Should -Not -BeNullOrEmpty
46+
}
47+
}
48+
```
49+
50+
1. **Update module manifest** if adding public function:
51+
52+
```powershell
53+
# Add to FunctionsToExport in PSScriptModule.psd1
54+
FunctionsToExport = @('Get-PSScriptModuleInfo', 'Get-Something')
55+
```
56+
57+
1. **Build and test**:
58+
59+
```powershell
60+
Invoke-Build Test
61+
```
62+
63+
### Making Changes
64+
65+
1. Create feature branch: `git checkout -b feature/my-feature`
66+
1. Make your changes
67+
1. Run tests: `Invoke-Build Test`
68+
1. Commit with semver keyword: `git commit -m "Add feature +semver: minor"`
69+
1. Push and create Pull Request
70+
1. After PR merge, automatic release is triggered
71+
72+
## 🎓 Learning Resources
73+
74+
- [PowerShell Best Practices](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/cmdlet-development-guidelines)
75+
- [Pester Documentation](https://pester.dev/)
76+
- [PSScriptAnalyzer Rules](https://github.com/PowerShell/PSScriptAnalyzer)
77+
- [Semantic Versioning](https://semver.org/)
78+
- [GitHub Flow](https://guides.github.com/introduction/flow/)

docs/generating-help.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Generating Help
2+
3+
This project uses [PlatyPS](https://github.com/PowerShell/platyPS) to generate extensive documentation:
4+
5+
- Markdown help files for each command
6+
- MAML files for PowerShell's Get-Help
7+
- Module-level documentation
8+
- Example sections for usage
9+
10+
```powershell
11+
12+
# Generate markdown and MAML help files
13+
Invoke-Build Export-CommandHelp
14+
```
15+
16+
Help files are generated in two formats:
17+
18+
1. **Markdown** (`.md`) - Stored in `docs/help/` for web/GitHub viewing
19+
1. **MAML** (`.xml`) - Stored in module's `en-US/` folder for `Get-Help` command
20+
21+
## Using Help in PowerShell
22+
23+
```powershell
24+
# Import your module
25+
Import-Module ./build/out/PSScriptModule/PSScriptModule.psd1
26+
27+
# View help
28+
Get-Help Get-PSScriptModuleInfo -Full
29+
Get-Help Get-PSScriptModuleInfo -Examples
30+
Get-Help Get-PSScriptModuleInfo -Online
31+
```

docs/getting-started.md

Whitespace-only changes.

docs/local-setup.md

Whitespace-only changes.

0 commit comments

Comments
 (0)