fix flags
This commit is contained in:
parent
054a5ff3c1
commit
8e0ec37d7d
@ -145,10 +145,7 @@ def _run(
|
|||||||
exec.output_system_info()
|
exec.output_system_info()
|
||||||
|
|
||||||
# If no --frontend-only and no --backend-only, then turn on frontend and backend both
|
# If no --frontend-only and no --backend-only, then turn on frontend and backend both
|
||||||
if not frontend and not backend:
|
frontend, backend = prerequisites.check_running_mode(frontend, backend)
|
||||||
frontend = True
|
|
||||||
backend = True
|
|
||||||
|
|
||||||
if not frontend and backend:
|
if not frontend and backend:
|
||||||
_skip_compile()
|
_skip_compile()
|
||||||
|
|
||||||
@ -306,10 +303,18 @@ def export(
|
|||||||
True, "--no-zip", help="Disable zip for backend and frontend exports."
|
True, "--no-zip", help="Disable zip for backend and frontend exports."
|
||||||
),
|
),
|
||||||
frontend: bool = typer.Option(
|
frontend: bool = typer.Option(
|
||||||
True, "--backend-only", help="Export only backend.", show_default=False
|
False,
|
||||||
|
"--frontend-only",
|
||||||
|
help="Export only frontend.",
|
||||||
|
show_default=False,
|
||||||
|
envvar=environment.REFLEX_FRONTEND_ONLY.name,
|
||||||
),
|
),
|
||||||
backend: bool = typer.Option(
|
backend: bool = typer.Option(
|
||||||
True, "--frontend-only", help="Export only frontend.", show_default=False
|
False,
|
||||||
|
"--backend-only",
|
||||||
|
help="Export only backend.",
|
||||||
|
show_default=False,
|
||||||
|
envvar=environment.REFLEX_BACKEND_ONLY.name,
|
||||||
),
|
),
|
||||||
zip_dest_dir: str = typer.Option(
|
zip_dest_dir: str = typer.Option(
|
||||||
str(Path.cwd()),
|
str(Path.cwd()),
|
||||||
@ -332,7 +337,9 @@ def export(
|
|||||||
from reflex.utils import export as export_utils
|
from reflex.utils import export as export_utils
|
||||||
from reflex.utils import prerequisites
|
from reflex.utils import prerequisites
|
||||||
|
|
||||||
if prerequisites.needs_reinit(frontend=True):
|
frontend, backend = prerequisites.check_running_mode(frontend, backend)
|
||||||
|
|
||||||
|
if prerequisites.needs_reinit(frontend=frontend or not backend):
|
||||||
_init(name=config.app_name, loglevel=loglevel)
|
_init(name=config.app_name, loglevel=loglevel)
|
||||||
|
|
||||||
if frontend and not config.show_built_with_reflex:
|
if frontend and not config.show_built_with_reflex:
|
||||||
|
@ -1225,6 +1225,21 @@ def install_frontend_packages(packages: set[str], config: Config):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def check_running_mode(frontend: bool, backend: bool) -> tuple[bool, bool]:
|
||||||
|
"""Check if the app is running in frontend or backend mode.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
frontend: Whether to run the frontend of the app.
|
||||||
|
backend: Whether to run the backend of the app.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The running modes.
|
||||||
|
"""
|
||||||
|
if not frontend and not backend:
|
||||||
|
return True, True
|
||||||
|
return frontend, backend
|
||||||
|
|
||||||
|
|
||||||
def needs_reinit(frontend: bool = True) -> bool:
|
def needs_reinit(frontend: bool = True) -> bool:
|
||||||
"""Check if an app needs to be reinitialized.
|
"""Check if an app needs to be reinitialized.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user