Skip to content

Commit 0cfbd35

Browse files
committed
chore: Add PowerShell scripts for checking dist directory and testing Scoop manifest updates
1 parent 85a31a8 commit 0cfbd35

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Write-Host "📁 Checking dist directory contents..."
2+
if (Test-Path 'dist') {
3+
Write-Host "✅ dist folder exists!"
4+
Get-ChildItem -Path 'dist' -Recurse | Select-Object FullName, Length
5+
}
6+
else {
7+
Write-Host "❌ dist folder not found!"
8+
}
9+
10+
Write-Host ""
11+
Write-Host "🔍 Looking for scoop manifest..."
12+
if (Test-Path 'dist/scoop/zed-cli-win-unofficial.json') {
13+
Write-Host "✅ Scoop manifest found!"
14+
Write-Host "📦 Original manifest contents:"
15+
Get-Content 'dist/scoop/zed-cli-win-unofficial.json' | Write-Host
16+
}
17+
else {
18+
Write-Host "❌ Scoop manifest not found in expected location"
19+
Write-Host "📁 Checking what's in dist/scoop/:"
20+
if (Test-Path 'dist/scoop') {
21+
Get-ChildItem 'dist/scoop' | Write-Host
22+
}
23+
else {
24+
Write-Host "❌ dist/scoop directory doesn't exist"
25+
}
26+
}

scripts/fix-scoop-manifest.ps1

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
Write-Host "🔧 Testing scoop manifest fix..."
2+
3+
if (Test-Path 'dist/scoop/zed-cli-win-unofficial.json') {
4+
Write-Host "✅ Found scoop manifest, reading contents..."
5+
6+
# Read the original content as text to preserve formatting
7+
$content = Get-Content 'dist/scoop/zed-cli-win-unofficial.json' -Raw
8+
9+
Write-Host "📄 Original manifest:"
10+
Write-Host $content
11+
12+
# Parse JSON to check current bin array (for logging only)
13+
$manifest = $content | ConvertFrom-Json
14+
Write-Host ""
15+
Write-Host "📋 Current bin array:"
16+
$manifest.architecture."64bit".bin | ForEach-Object { Write-Host " - $_" }
17+
18+
# Use regex to find and modify the bin array while preserving formatting
19+
# This looks for the bin array pattern and adds zed.bat if not already present
20+
if ($content -notmatch '"zed-cli-win-unofficial/zed\.bat"') {
21+
Write-Host ""
22+
Write-Host "🔧 Adding zed.bat to bin array..."
23+
24+
# Find the bin array and add the new entry
25+
# Pattern matches: "bin": ["existing-entry"] or "bin": ["entry1", "entry2"]
26+
$pattern = '("bin":\s*\[\s*"[^"]+")(\s*\])'
27+
$replacement = '$1, "zed-cli-win-unofficial/zed.bat"$2'
28+
29+
$updatedContent = $content -replace $pattern, $replacement
30+
31+
Write-Host "📄 Updated manifest:"
32+
Write-Host $updatedContent
33+
34+
# Create bucket directory for testing
35+
if (-not (Test-Path 'bucket')) {
36+
New-Item -ItemType Directory -Path 'bucket'
37+
Write-Host ""
38+
Write-Host "📁 Created bucket directory (for testing)"
39+
}
40+
41+
# Save the updated manifest with preserved formatting
42+
$updatedContent | Set-Content 'bucket/zed-cli-win-unofficial.json' -NoNewline
43+
Write-Host ""
44+
Write-Host "💾 Saved updated manifest to bucket/ (for testing)"
45+
Write-Host "✅ Scoop manifest fix test successful!"
46+
47+
}
48+
else {
49+
Write-Host ""
50+
Write-Host "✅ zed.bat already exists in bin array"
51+
}
52+
53+
}
54+
else {
55+
Write-Host "❌ Scoop manifest not found"
56+
exit 1
57+
}

scripts/show-commit-summary.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Write-Host "📊 Summary of what would be committed to repository:"
2+
Write-Host ""
3+
4+
if (Test-Path 'bucket/zed-cli-win-unofficial.json') {
5+
Write-Host "✅ bucket/zed-cli-win-unofficial.json"
6+
Write-Host " Size: $((Get-Item 'bucket/zed-cli-win-unofficial.json').Length) bytes"
7+
Write-Host ""
8+
Write-Host "📄 File contents that would be committed:"
9+
Get-Content 'bucket/zed-cli-win-unofficial.json' | Write-Host
10+
}
11+
else {
12+
Write-Host "❌ No manifest file to commit"
13+
}
14+
15+
Write-Host ""
16+
Write-Host "🚀 In a real release, this would:"
17+
Write-Host " 1. Create/update bucket/zed-cli-win-unofficial.json"
18+
Write-Host " 2. Commit with message: 'Scoop update for zed-cli-win-unofficial version ${env:GITHUB_REF_NAME}'"
19+
Write-Host " 3. Push to main branch"
20+
Write-Host ""
21+
Write-Host "ℹ️ To enable actual committing, update the workflow to include git commands"

0 commit comments

Comments
 (0)