from pathlib import Path from zipfile import ZipFile, ZIP_DEFLATED root = Path(__file__).resolve().parents[1] destination = root.parent / "ZeyadsStuffV2.zip" excluded = {"node_modules", ".npm-cache", ".wrangler", "dist", ".git"} with ZipFile(destination, "w", ZIP_DEFLATED) as archive: for path in sorted(root.rglob("*")): relative = path.relative_to(root) if not path.is_file() or any(part in excluded for part in relative.parts): continue if path.name in {".dev.vars", ".deploy-secrets.json", ".proxy-passphrase.txt", "worker-configuration.d.ts"}: continue if path.name.startswith(".env"): continue archive.write(path, Path("ZeyadsStuffV2") / relative) with ZipFile(destination) as archive: assert archive.testzip() is None names = archive.namelist() assert "ZeyadsStuffV2/launcher.html" in names assert "ZeyadsStuffV2/src/index.ts" in names assert "ZeyadsStuffV2/.dev.vars" not in names assert "ZeyadsStuffV2/.deploy-secrets.json" not in names assert "ZeyadsStuffV2/.proxy-passphrase.txt" not in names print(f"{destination} ({destination.stat().st_size:,} bytes; {len(names)} files)")