"""Bundle the editable project and rendered videos, excluding generated caches."""
from pathlib import Path
from zipfile import ZipFile, ZIP_DEFLATED

root = Path(__file__).resolve().parent.parent
target = root / 'output' / 'elektring-projekat.zip'
with ZipFile(target, 'w', ZIP_DEFLATED, compresslevel=6) as archive:
    for file in sorted(root.rglob('*')):
        relative = file.relative_to(root)
        if not file.is_file() or file == target:
            continue
        if any(part in {'node_modules', 'dist', '.git', '__pycache__'} for part in relative.parts):
            continue
        if file.name.endswith(('.partial.mp4', '.log')):
            continue
        archive.write(file, Path('elektring') / relative)
print(f'Project archive: {target}')
