REFLEX_USE_NPM escape hatch to opt out of bun

In some unsupported environments, we need to just not use bun. Further
investigation needed.
This commit is contained in:
Masen Furer 2024-05-14 17:01:28 -07:00
parent d3723dbd3e
commit 7f0fb41752
No known key found for this signature in database
GPG Key ID: B0008AD22B3B3A95

View File

@ -185,6 +185,7 @@ def get_install_package_manager() -> str | None:
constants.IS_WINDOWS
and not is_windows_bun_supported()
or windows_check_onedrive_in_path()
or windows_npm_escape_hatch()
):
return get_package_manager()
return get_config().bun_path
@ -212,6 +213,15 @@ def windows_check_onedrive_in_path() -> bool:
return "onedrive" in str(Path.cwd()).lower()
def windows_npm_escape_hatch() -> bool:
"""For windows, if the user sets REFLEX_USE_NPM, use npm instead of bun.
Returns:
If the user has set REFLEX_USE_NPM.
"""
return os.environ.get("REFLEX_USE_NPM", "").lower() in ["true", "1", "yes"]
def get_app(reload: bool = False) -> ModuleType:
"""Get the app module based on the default config.