Skip to content

The agent that grows with you

perf(cli): add --prefer-offline to npm install during update (#39267)

Rod Boevbdcdde9ff607
diff --git a/hermes_cli/main.py b/hermes_cli/main.py
index 98874824c19..cd9966cf8cf 100644
--- a/hermes_cli/main.py
+++ b/hermes_cli/main.py
@@ -5710,7 +5710,7 @@ def _do_build_web_ui(web_dir: Path, *, fatal: bool = False) -> bool:
return _run_npm_install_deterministic(
npm,
npm_cwd,
- extra_args=(*npm_workspace_args, "--silent") if silent else npm_workspace_args,
+ extra_args=(*npm_workspace_args, "--silent", "--prefer-offline") if silent else (*npm_workspace_args, "--prefer-offline"),
env=build_env,
)
diff --git a/hermes_cli/update_cmd.py b/hermes_cli/update_cmd.py
index 240bb0fc9b5..c9069b1b1a2 100644
--- a/hermes_cli/update_cmd.py
+++ b/hermes_cli/update_cmd.py
@@ -2089,7 +2089,7 @@ def _update_node_dependencies() -> list[str]:
print(" deps). Fix npm and re-run `hermes update`.")
return list(labels)
- extra_args = ["--no-fund", "--no-audit", "--progress=false"]
+ extra_args = ["--no-fund", "--no-audit", "--prefer-offline", "--progress=false"]
from hermes_constants import with_hermes_node_path
diff --git a/tests/hermes_cli/test_web_ui_build.py b/tests/hermes_cli/test_web_ui_build.py
index 6e736bb931d..e12e9050c6c 100644
--- a/tests/hermes_cli/test_web_ui_build.py
+++ b/tests/hermes_cli/test_web_ui_build.py
@@ -150,7 +150,7 @@ class TestBuildWebUISkipsWhenFresh:
assert result is True
args, kwargs = mock_run.call_args
assert "--workspace" not in args[0]
- assert args[0] == ["/usr/bin/npm", "ci", "--include=dev", "--silent"]
+ assert args[0] == ["/usr/bin/npm", "ci", "--include=dev", "--silent", "--prefer-offline"]
assert kwargs["cwd"] == web_dir
def test_web_build_uses_idle_timeout_helper(self, tmp_path):