Optimize .zip size
All checks were successful
SteamWarCI Build successful

This commit is contained in:
2025-06-11 14:11:54 +02:00
parent c6417c74f1
commit 82ba75fae7
18 changed files with 20 additions and 0 deletions

10
9/build.py Normal file
View File

@ -0,0 +1,10 @@
import os
current_dir = os.getcwd()
# Removing all .md files
for root, dirs, files in os.walk(current_dir):
for file in files:
src_file = os.path.join(root, file)
if os.path.isfile(src_file) and file.endswith(".md"):
os.remove(src_file)

View File

@ -5,6 +5,7 @@ import hashlib
import time
import zipfile
import importlib.util
import json
current_dir = os.getcwd()
@ -58,6 +59,15 @@ def copyFiles(src, dst):
dst_file = os.path.join(dest_path, file)
shutil.copy2(src_file, dst_file) # Overwrites if exists
if dst_file.endswith(".json") or dst_file.endswith(".mcmeta"):
content = ""
with open(dst_file, "r") as file:
content = file.read()
content = json.loads(content)
content = json.dumps(content, separators=(',', ':'))
with open(dst_file, "w") as file:
file.write(content)
def zip_folder(folder_path, zip_file_path):
with zipfile.ZipFile(zip_file_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
for root, dirs, files in os.walk(folder_path):

View File

Before

Width:  |  Height:  |  Size: 606 B

After

Width:  |  Height:  |  Size: 606 B

View File

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 607 B

View File

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 610 B

View File

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 607 B

View File

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 610 B

View File

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 610 B

View File

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 610 B

View File

Before

Width:  |  Height:  |  Size: 609 B

After

Width:  |  Height:  |  Size: 609 B

View File

Before

Width:  |  Height:  |  Size: 612 B

After

Width:  |  Height:  |  Size: 612 B

View File

Before

Width:  |  Height:  |  Size: 606 B

After

Width:  |  Height:  |  Size: 606 B

View File

Before

Width:  |  Height:  |  Size: 613 B

After

Width:  |  Height:  |  Size: 613 B

View File

Before

Width:  |  Height:  |  Size: 608 B

After

Width:  |  Height:  |  Size: 608 B

View File

Before

Width:  |  Height:  |  Size: 608 B

After

Width:  |  Height:  |  Size: 608 B

View File

Before

Width:  |  Height:  |  Size: 611 B

After

Width:  |  Height:  |  Size: 611 B

View File

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 607 B

View File

Before

Width:  |  Height:  |  Size: 614 B

After

Width:  |  Height:  |  Size: 614 B