-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.ps1
More file actions
67 lines (56 loc) · 1.97 KB
/
package.ps1
File metadata and controls
67 lines (56 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Package DevTools for distribution (ModDB, Nexus, etc.)
# Usage: .\package.ps1
$ModName = "Anomaly_DevTools"
$Version = "1.3.5"
$OutputDir = "$PSScriptRoot\releases"
$ZipName = "${ModName}_v${Version}.zip"
Write-Host "Packaging $ModName v$Version..." -ForegroundColor Cyan
# Create releases folder if needed
if (-not (Test-Path $OutputDir)) {
New-Item -ItemType Directory -Path $OutputDir -Force | Out-Null
}
# Files to include in the package
$FilesToInclude = @(
"gamedata",
"README.md",
"documentation.md",
"meta.ini"
)
# Create a temp folder for clean packaging
$TempDir = "$env:TEMP\$ModName"
if (Test-Path $TempDir) {
Remove-Item -Path $TempDir -Recurse -Force
}
New-Item -ItemType Directory -Path $TempDir -Force | Out-Null
# Copy files to temp
foreach ($item in $FilesToInclude) {
$sourcePath = "$PSScriptRoot\$item"
if (Test-Path $sourcePath) {
Copy-Item -Path $sourcePath -Destination $TempDir -Recurse -Force
Write-Host " Added: $item" -ForegroundColor Gray
} else {
Write-Host " WARNING: Not found: $item" -ForegroundColor Yellow
}
}
# Remove the detailed README (keep only user-facing README.txt)
$DetailedReadme = "$TempDir\gamedata\scripts\devtools_README.md"
if (Test-Path $DetailedReadme) {
# Keep it - it's useful documentation
Write-Host " Included: devtools_README.md (detailed docs)" -ForegroundColor Gray
}
# Create zip
$ZipPath = "$OutputDir\$ZipName"
if (Test-Path $ZipPath) {
Remove-Item -Path $ZipPath -Force
}
Compress-Archive -Path "$TempDir\*" -DestinationPath $ZipPath -CompressionLevel Optimal
# Cleanup temp
Remove-Item -Path $TempDir -Recurse -Force
# Show result
$ZipSize = (Get-Item $ZipPath).Length / 1KB
Write-Host ""
Write-Host "Package created successfully!" -ForegroundColor Green
Write-Host " Output: $ZipPath" -ForegroundColor Cyan
Write-Host " Size: $([math]::Round($ZipSize, 2)) KB" -ForegroundColor Cyan
Write-Host ""
Write-Host "Ready to upload to ModDB!" -ForegroundColor Yellow