dv_locofaces/package.ps1

29 lines
749 B
PowerShell
Raw Normal View History

2023-11-15 16:00:06 +00:00
param (
[switch]$NoArchive,
[string]$OutputDirectory = $PSScriptRoot
)
Set-Location "$PSScriptRoot"
2023-11-15 19:16:46 +00:00
$FilesToInclude = "info.json","build/*","LICENSE","facesbundle"
2023-11-15 16:00:06 +00:00
$modInfo = Get-Content -Raw -Path "info.json" | ConvertFrom-Json
$modId = $modInfo.Id
$modVersion = $modInfo.Version
$DistDir = "$OutputDirectory/dist"
if ($NoArchive) {
$ZipWorkDir = "$OutputDirectory"
} else {
$ZipWorkDir = "$DistDir/tmp"
}
2023-11-15 19:42:27 +00:00
$ZipOutDir = "$ZipWorkDir/Locomotive Faces"
2023-11-15 16:00:06 +00:00
New-Item "$ZipOutDir" -ItemType Directory -Force
Copy-Item -Force -Path $FilesToInclude -Destination "$ZipOutDir"
if (!$NoArchive)
{
$FILE_NAME = "$DistDir/${modId}_v$modVersion.zip"
Compress-Archive -Update -CompressionLevel Fastest -Path "$ZipOutDir/*" -DestinationPath "$FILE_NAME"
}