| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This example combines the complete PSScriptBuilder lifecycle in a single Run-Example.ps1: version bump, file update, module build, post-processing, demo. All five phases run in sequence, showing how release management, script building, and post-processing work together end to end.
The five phases of a full workflow:
| Phase | Cmdlet(s) | What happens |
|---|---|---|
| 1 - Update release data | Update-PSScriptBuilderReleaseData | Bumps version, refreshes build metadata |
| 2 - Apply version to files | Update-PSScriptBuilderBumpFiles | Writes version into manifest and template header |
| 3 - Build module | Invoke-PSScriptBuilderBuild | Collects classes/functions, fills template, writes .psm1 |
| 4 - Post-process | Compress-PSScriptBuilderScript | Removes comments and blank lines, writes AppConfig.compressed.psm1 |
| 5 - Demo | Demo-Module.ps1 | Loads built module, confirms version, exercises types |
Version flows through all layers:
releasedata.json feeds into AppConfig.psd1 (manifest), AppConfig.psm1.template (header), and CHANGELOG.md (metadata comment). The built AppConfig.psm1 and Demo-Module.ps1 confirm the version is correctly carried through all four phases.
Two tokens in one bump entry: The CHANGELOG.md entry in psscriptbuilder.bumpconfig.json uses both VERSION and BUILD_DATE tokens. Each token gets its own Simple item (for first run) and Regex item (for subsequent runs) within the same entry.
Mixed Bump Mode is used here too - the bump config entries each have a Simple item ({{VERSION}}) for the first run and a Regex item for all subsequent runs. See Example 11 for a dedicated explanation.
12-full-workflow/
+-- Run-Example.ps1 Entry point - all four phases
+-- Demo-Module.ps1 Loads built module, confirms version and types
+-- Reset-Example.ps1 Restores all files to initial token state
+-- README.md This file
+-- CHANGELOG.md Tracks releases; version + date bumped automatically
+-- CHANGELOG.initial.md Initial token state (used by Reset-Example.ps1)
+-- psscriptbuilder.config.json Build configuration
+-- src/
| +-- Classes/
| | +-- ConfigEntry.ps1 Class: Key, Value, Description; ToString()
| | +-- AppConfig.ps1 Class: Name, Entries; Add(), Get(), Contains(), Count()
| +-- Functions/
| +-- New-ConfigEntry.ps1 Factory function, returns [ConfigEntry]
| +-- New-AppConfig.ps1 Factory function, returns [AppConfig]
| +-- Get-ConfigValue.ps1 Gets a value by key, supports -Default parameter
+-- build/
+-- Release/
| +-- psscriptbuilder.releasedata.json Current release data (modified by Run-Example.ps1)
| +-- psscriptbuilder.releasedata.initial.json Initial state (used by Reset-Example.ps1)
| +-- psscriptbuilder.bumpconfig.json Bump targets: manifest, template header, CHANGELOG
+-- Templates/
| +-- AppConfig.psm1.template Template with version header + class/function placeholders
+-- Output/
+-- AppConfig.psd1 Module manifest ({{VERSION}} initially)
+-- AppConfig.compressed.psm1 Post-processed output (comments + blank lines removed)
Warning: Run in a fresh PowerShell session
The using module statement loads types into the current session.
Reloading or switching between examples in the same session can cause type conflicts.
.\Run-Example.ps1To run the example again from scratch:
.\Reset-Example.ps1
.\Run-Example.ps1=== Phase 1: Update release data ===
Category: Version
Property : patch
Old Value : 0
New Value : 1
Property : full
Old Value : 1.0.0
New Value : 1.0.1
Category: Build
Property : number
Old Value : 0
New Value : 1
Property : date
Old Value : 2026-01-01
New Value : 2026-03-28
...
=== Phase 2: Apply version to files ===
File: ...\build\Output\AppConfig.psd1
Pattern : {{VERSION}}
Token : VERSION
Old Value : {{VERSION}}
New Value : 1.0.1
File: ...\build\Templates\AppConfig.psm1.template
Pattern : {{VERSION}}
Token : VERSION
Old Value : {{VERSION}}
New Value : 1.0.1
File: ...\CHANGELOG.md
Pattern : {{VERSION}}
Token : VERSION
Old Value : {{VERSION}}
New Value : 1.0.1
Pattern : {{BUILD_DATE}}
Token : BUILD_DATE
Old Value : {{BUILD_DATE}}
New Value : 2026-03-28
=== Phase 3: Build module ===
Build Summary
Output: ...\build\Output\AppConfig.psm1
Size : 2.05 KB
Time : 77.73 ms
Components
Classes : 2
Functions: 3
Total : 5
=== Phase 4: Post-process output ===
Post-processing complete.
=== Phase 5: Demo ===
Module version : 1.0.1
Config : AppSettings
Entries : 4
Environment = Production # Deployment environment
LogLevel = Warning # Minimum log level
MaxRetries = 3 # Maximum retry attempts
Timeout = 30
Environment : Production
ApiKey : (not set)
Type of entry : ConfigEntry
Type of config : AppConfig
| Back | FazBrowse Home | New Git URL |