From 5188715ade356778329ab8449714439c6d03da57 Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Wed, 19 Feb 2025 09:42:09 -0800 Subject: [PATCH] Include .web/backend directory in backend.zip when exporting --- reflex/utils/build.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/reflex/utils/build.py b/reflex/utils/build.py index 9e35ab984..c02a30c7b 100644 --- a/reflex/utils/build.py +++ b/reflex/utils/build.py @@ -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 / "*") + ], )