perf(cli): add --prefer-offline to npm install during update (#39267)
Re-derivation of PR #39399 onto current main: pass --prefer-offline to the web-UI workspace install (both silent and verbose arms of _install_web_deps) and to the update-time Node dependency refresh in _update_node_dependencies, so npm reuses its local cache instead of re-fetching metadata. Test expectations updated to match, mirroring the PR's own test-update commit.
This commit is contained in:
+1
-1
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user