Ver código fonte

REFLEX_USE_NPM escape hatch to opt out of bun

In some unsupported environments, we need to just not use bun. Further
investigation needed.
Masen Furer 1 ano atrás
pai
commit
7f0fb41752
1 arquivos alterados com 10 adições e 0 exclusões
  1. 10 0
      reflex/utils/prerequisites.py

+ 10 - 0
reflex/utils/prerequisites.py

@@ -185,6 +185,7 @@ def get_install_package_manager() -> str | None:
         constants.IS_WINDOWS
         constants.IS_WINDOWS
         and not is_windows_bun_supported()
         and not is_windows_bun_supported()
         or windows_check_onedrive_in_path()
         or windows_check_onedrive_in_path()
+        or windows_npm_escape_hatch()
     ):
     ):
         return get_package_manager()
         return get_package_manager()
     return get_config().bun_path
     return get_config().bun_path
@@ -212,6 +213,15 @@ def windows_check_onedrive_in_path() -> bool:
     return "onedrive" in str(Path.cwd()).lower()
     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:
 def get_app(reload: bool = False) -> ModuleType:
     """Get the app module based on the default config.
     """Get the app module based on the default config.