From 63f258d034bb69c289d565b1b1f141b11c2396c7 Mon Sep 17 00:00:00 2001 From: Cypress_Ik727 Date: Tue, 19 Mar 2024 12:49:20 +0000 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.ps1 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 package.ps1 diff --git a/package.ps1 b/package.ps1 new file mode 100644 index 0000000..623f5c5 --- /dev/null +++ b/package.ps1 @@ -0,0 +1,29 @@ +param ( + [switch]$NoArchive, + [string]$OutputDirectory = $PSScriptRoot +) + +Set-Location "$PSScriptRoot" +$FilesToInclude = "info.json","build/*","LICENSE","assetbundles" + +$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" +} +$ZipOutDir = "$ZipWorkDir/$modId" + +New-Item "$ZipOutDir" -ItemType Directory -Force +Copy-Item -Force -Path $FilesToInclude -Destination "$ZipOutDir" +Copy-Item -Force -Path "assetbundles/*" -Destination "$ZipOutDir/assetbundles" + +if (!$NoArchive) +{ + $FILE_NAME = "$DistDir/${modId}_v$modVersion.zip" + Compress-Archive -Update -CompressionLevel Fastest -Path "$ZipOutDir/*" -DestinationPath "$FILE_NAME" +}