added versioning for powershell apps
This commit is contained in:
@@ -3,6 +3,13 @@
|
|||||||
## General Rules
|
## General Rules
|
||||||
|
|
||||||
- Always include `#Requires -Version 5.1` at the top of every `.ps1` file
|
- Always include `#Requires -Version 5.1` at the top of every `.ps1` file
|
||||||
|
- Declare `$Version` immediately after `#Requires`, using semantic versioning (`"MAJOR.MINOR.PATCH"`):
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
#Requires -Version 5.1
|
||||||
|
$Version = "1.0.0"
|
||||||
|
```
|
||||||
|
|
||||||
- Use `$script:` scope for module-level variables — never `$Global:` unless absolutely necessary
|
- Use `$script:` scope for module-level variables — never `$Global:` unless absolutely necessary
|
||||||
- Keep credential and sensitive values out of code — load from config files or environment variables only
|
- Keep credential and sensitive values out of code — load from config files or environment variables only
|
||||||
- Use `.psd1` files for all external configuration (not JSON, not XML, not hardcoded)
|
- Use `.psd1` files for all external configuration (not JSON, not XML, not hardcoded)
|
||||||
@@ -65,6 +72,11 @@ Add-Type -AssemblyName System.Windows.Forms
|
|||||||
|
|
||||||
- Define XAML as a here-string and load it via `[System.Windows.Markup.XamlReader]::Parse()`
|
- Define XAML as a here-string and load it via `[System.Windows.Markup.XamlReader]::Parse()`
|
||||||
- Use `$script:` variables to hold window/control references so they're accessible across functions
|
- Use `$script:` variables to hold window/control references so they're accessible across functions
|
||||||
|
- Set the window title to include `$Version` after the app name:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$Window.Title = "App Name v$Version"
|
||||||
|
```
|
||||||
|
|
||||||
## Modules
|
## Modules
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user