Include .web/backend directory in backend.zip when exporting

This commit is contained in:
Masen Furer 2025-02-19 09:42:09 -08:00
parent e9cf4ce1a5
commit 5188715ade
No known key found for this signature in database
GPG Key ID: B0008AD22B3B3A95

View File

@ -60,6 +60,7 @@ def _zip(
dirs_to_exclude: set[str] | None = None,
files_to_exclude: set[str] | None = None,
top_level_dirs_to_exclude: set[str] | None = None,
globs_to_include: list[str] | None = None,
) -> None:
"""Zip utility function.
@ -72,6 +73,7 @@ def _zip(
dirs_to_exclude: The directories to exclude.
files_to_exclude: The files to exclude.
top_level_dirs_to_exclude: The top level directory names immediately under root_dir to exclude. Do not exclude folders by these names further in the sub-directories.
globs_to_include: Apply these globs from the root_dir and always include them in the zip.
"""
target = Path(target)
@ -103,6 +105,13 @@ def _zip(
files_to_zip += [
str(root / file) for file in files if file not in files_to_exclude
]
if globs_to_include:
for glob in globs_to_include:
files_to_zip += [
str(file)
for file in root_dir.glob(glob)
if file.name not in files_to_exclude
]
# Create a progress bar for zipping the component.
progress = Progress(
@ -160,6 +169,9 @@ def zip_app(
top_level_dirs_to_exclude={"assets"},
exclude_venv_dirs=True,
upload_db_file=upload_db_file,
globs_to_include=[
str(Path(constants.Dirs.WEB) / constants.Dirs.BACKEND / "*")
],
)