Skip to content

Commit

Permalink
packager -> compressor
Browse files Browse the repository at this point in the history
It's just for tossing zips around 😁
  • Loading branch information
ls- committed Dec 8, 2022
1 parent 5c9d7ac commit cd466cf
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions .packager.ps1 β†’ .compressor.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,41 @@ Set-Alias 7z "C:\PROGRA~1\7-Zip\7z.exe"

$name = (Get-Item .).Name

if (-Not (Test-Path (".\" + $name + ".toc"))) {
if (-Not (Test-Path (".\" + $name + "\" + $name + ".toc"))) {
Write-Host ".toc not found"

return Read-Host
}

if (Get-Content (".\" + $name + ".toc") | Where { $_ -match "(Version: +)([a-zA-Z0-9.-]+)" }) {
$version = $matches[2]
if (Get-Content (".\" + $name + "\" + $name + ".toc") | Where-Object { $_ -match "Version:\s*([a-zA-Z0-9.-]+)" }) {
$version = $matches[1]
} else {
Write-Host "Bad version format"

return Read-Host
}

$includedFiles = @(
".\init.lua",
".\LICENSE.txt",
".\ls_Toasts.toc",
".\assets\",
".\core\",
".\embeds\"
".\locales\",
".\skins\",
".\systems\"
$includedItems = @(
".\" + $name
)

$filesToRemove = @(
"*.doc*"
"*.editorconfig",
"*.git*",
"*.luacheck*",
"*.pkg*",
"*.ps1",
"*.yml"
)

if (Test-Path ".\temp\") {
Remove-Item ".\temp\" -Recurse -Force
}

New-Item -Path (".\temp\" + $name) -ItemType Directory | Out-Null
Copy-Item $includedFiles -Destination (".\temp\" + $name) -Recurse
New-Item -Path (".\temp\") -ItemType Directory | Out-Null
Copy-Item $includedItems -Destination (".\temp\") -Recurse
Remove-Item ".\temp" -Include $filesToRemove -Recurse -Force

Set-Location ".\temp\"

Expand Down

0 comments on commit cd466cf

Please sign in to comment.