Skip to content

Commit eb4efa2

Browse files
committed
✨ [feat] Enhances ANSI art and updates module
Updates module version and improves ANSI art rendering in welcome scripts. - 🎨 Enhances ANSI art rendering in `welcome-Bears2.ps1`: - Reduces `$repeatCount` from 6 to 3, likely optimizing the visual layout. - Introduces a second row of bears with a shifted color palette (`($repeat + 3) % $colors.Count`), adding visual variety. 🐻🌈 - 🎨 Improves ANSI art generation in `welcome-cats.ps1`: - Introduces a loop to generate two rows of cats. 🐱 - Modifies color selection to create a different color pattern for each row. - Uses `$boldon` to make the cats bold. - 🧹 Updates module manifest: - Bumps `ModuleVersion` from `'2025.10.13.1043'` to `'2025.10.13.1447'`, reflecting code changes 🔢 - Updates the corresponding `ReleaseNotes` in the module manifest. - 📝 Adds new scripts and updates documentation: - Introduces `Format-ColorScripts.ps1` to format PowerShell scripts using `Invoke-Formatter`, improving code consistency. ✍️ - Updates `package.json` to include a command for formatting scripts: `"scripts:format": "pwsh -NoProfile -File ./scripts/Format-ColorScripts.ps1"`. ⚙️ - Updates `Development.md` with documentation for the new script conversion options and the format script. 📖 - 👷 Updates dependencies: - Upgrades `markdown-link-check` from `3.12.2` to `3.14.1` in `package.json` and `package-lock.json`, likely to address bugs or improve link checking functionality. 🔗 Signed-off-by: Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com>
1 parent 77c2508 commit eb4efa2

7 files changed

Lines changed: 74 additions & 12 deletions

File tree

ColorScripts-Enhanced/ColorScripts-Enhanced.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
RootModule = 'ColorScripts-Enhanced.psm1'
1212

1313
# Version number of this module.
14-
ModuleVersion = '2025.10.13.1043'
14+
ModuleVersion = '2025.10.13.1447'
1515

1616
# Supported PSEditions
1717
CompatiblePSEditions = @('Desktop', 'Core')
@@ -155,7 +155,7 @@
155155

156156
# ReleaseNotes of this module
157157
ReleaseNotes = @'
158-
Version 2025.10.13.1043:
158+
Version 2025.10.13.1447:
159159
- Enhanced caching system with OS-wide cache in AppData
160160
- 6-19x performance improvement
161161
- Cache stored in centralized location

ColorScripts-Enhanced/Scripts/welcome-Bears2.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ $bearLines = @(
1717
$colors = @(31, 33, 32, 34, 35, 37) # Red, Yellow, Green, Blue, Magenta, White
1818

1919
# Number of repeats
20-
$repeatCount = 6
20+
$repeatCount = 3
2121

2222
# Build the output
2323
$output = ""
24+
25+
# First row (3 bears)
2426
for ($lineIdx = 0; $lineIdx -lt $bearLines.Count; $lineIdx++) {
2527
$line = ""
2628
for ($repeat = 0; $repeat -lt $repeatCount; $repeat++) {
@@ -30,4 +32,14 @@ for ($lineIdx = 0; $lineIdx -lt $bearLines.Count; $lineIdx++) {
3032
$output += "$line`n"
3133
}
3234

35+
# Second row (3 bears)
36+
for ($lineIdx = 0; $lineIdx -lt $bearLines.Count; $lineIdx++) {
37+
$line = ""
38+
for ($repeat = 0; $repeat -lt $repeatCount; $repeat++) {
39+
$color = $colors[($repeat + 3) % $colors.Count]
40+
$line += "$esc[${color}m$boldon$($bearLines[$lineIdx])$reset"
41+
}
42+
$output += "$line`n"
43+
}
44+
3345
Write-Host "$reset$output"

ColorScripts-Enhanced/Scripts/welcome-cats.ps1

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ $colors = @(31, 33, 32, 34, 35, 36) # Red, Yellow, Green, Blue, Magenta, Cyan
1717

1818
# Build the output
1919
$output = ""
20-
foreach ($line in $catLines) {
21-
$coloredLine = ""
22-
for ($i = 0; $i -lt 6; $i++) {
23-
$color = $colors[$i]
24-
$coloredLine += "$esc[${color}m$line$reset"
20+
for ($row = 0; $row -lt 2; $row++) {
21+
foreach ($line in $catLines) {
22+
$coloredLine = ""
23+
for ($i = 0; $i -lt 3; $i++) {
24+
$colorIdx = ($row * 3 + $i) % $colors.Count
25+
$color = $colors[$colorIdx]
26+
$coloredLine += "$esc[${color}m$boldon$line$reset"
27+
}
28+
$output += "$coloredLine`n"
2529
}
26-
$output += "$coloredLine`n"
2730
}
2831

29-
Write-Host "$reset$boldon$output"
32+
Write-Host "$reset$output"

docs/Development.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ We publish a set of convenience commands in `package.json` so you can run common
3838
| `npm run docs:update-counts` | Call `Update-DocumentationCounts.ps1` to sync README markers. |
3939
| `npm run package:metadata -- --PackagePath <nupkg>` | Run `Update-NuGetPackageMetadata.ps1` to embed README/license/icon before pushing. |
4040
| `npm run scripts:convert -- <ansi-file>` | Convert ANSI artwork via the Node-based converter. |
41+
| `npm run scripts:convert:ps -- <ansi-file>` | Convert ANSI artwork using the PowerShell helper script. |
42+
| `npm run scripts:convert:advanced` | Launch the advanced ANSI conversion workflow in PowerShell. |
4143
| `npm run scripts:split -- <file> [options]` | Split tall ANSI or PowerShell scripts into manageable slices. |
4244
| `npm run scripts:test-all` | Run `Test-AllColorScripts.ps1` across the entire library. |
45+
| `npm run scripts:format` | Run Invoke-Formatter across every colorscript in `ColorScripts-Enhanced/Scripts`. |
4346
| `npm run release:notes` | Generate unreleased release notes using git-cliff (PowerShell Gallery snippet). |
4447
| `npm run release:notes:latest` | Generate release notes for the most recent tag. |
4548
| `npm run release:verify` | Ensure CHANGELOG.md aligns with the manifest version and git-cliff output. |

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"scripts:convert:ps": "pwsh -NoProfile -File ./Convert-AnsiToColorScript.ps1",
2828
"scripts:convert:advanced": "pwsh -NoProfile -File ./Convert-AnsiToColorScript-Advanced.ps1",
2929
"scripts:split": "node ./scripts/Split-AnsiFile.js",
30+
"scripts:format": "pwsh -NoProfile -File ./scripts/Format-ColorScripts.ps1",
3031
"scripts:count": "pwsh -NoProfile -File ./Get-ColorScriptCount.ps1",
3132
"scripts:test-all": "pwsh -NoProfile -File ./ColorScripts-Enhanced/Test-AllColorScripts.ps1",
3233
"release:notes": "pwsh -NoProfile -File ./scripts/Generate-ReleaseNotes.ps1 -Unreleased -OutputPath ./dist/PowerShellGalleryReleaseNotes.md -StripHeader",
@@ -64,6 +65,6 @@
6465
"node-ansiparser": "^2.2.1"
6566
},
6667
"devDependencies": {
67-
"markdown-link-check": "^3.12.2"
68+
"markdown-link-check": "^3.14.1"
6869
}
6970
}

scripts/Format-ColorScripts.ps1

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#Requires -Version 5.1
2+
3+
[CmdletBinding(SupportsShouldProcess = $true)]
4+
param(
5+
[Parameter()]
6+
[string]$Path = (Join-Path -Path (Split-Path -Parent $PSScriptRoot) -ChildPath 'ColorScripts-Enhanced\Scripts')
7+
)
8+
9+
Set-StrictMode -Version Latest
10+
$ErrorActionPreference = 'Stop'
11+
12+
$resolvedPath = Resolve-Path -LiteralPath $Path -ErrorAction Stop
13+
$files = Get-ChildItem -Path $resolvedPath -Filter '*.ps1' -File -Recurse | Sort-Object FullName
14+
15+
if (-not $files) {
16+
Write-Host "No PowerShell scripts found under $resolvedPath." -ForegroundColor Yellow
17+
return
18+
}
19+
20+
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
21+
$formattedCount = 0
22+
$skippedCount = 0
23+
24+
foreach ($file in $files) {
25+
$original = Get-Content -LiteralPath $file.FullName -Raw
26+
if ([string]::IsNullOrWhiteSpace($original)) {
27+
$skippedCount++
28+
continue
29+
}
30+
$formatted = Invoke-Formatter -ScriptDefinition $original
31+
32+
if ($formatted -ne $original) {
33+
if ($PSCmdlet.ShouldProcess($file.FullName, 'Apply Invoke-Formatter output')) {
34+
[System.IO.File]::WriteAllText($file.FullName, $formatted, $utf8NoBom)
35+
$formattedCount++
36+
}
37+
}
38+
else {
39+
$skippedCount++
40+
}
41+
}
42+
43+
Write-Host "Formatted $formattedCount file(s); $skippedCount already compliant." -ForegroundColor Green

0 commit comments

Comments
 (0)