From 750f31482ee1e073e2be14fb4ffa3ade697f4511 Mon Sep 17 00:00:00 2001 From: Elior Nataf Lackritz Date: Wed, 12 Aug 2026 16:03:24 -0400 Subject: [PATCH] fix(cli): cover every npm install lifecycle hook npm runs prepublish, preprepare and postprepare on install too, so a project using one of those would have had its install layer split and the hook would run against a source tree that is not there yet. --- libs/cli/langgraph_cli/config.py | 12 ++++++++++-- libs/cli/tests/unit_tests/test_config.py | 11 ++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libs/cli/langgraph_cli/config.py b/libs/cli/langgraph_cli/config.py index 56d34f6b6..5a842887f 100644 --- a/libs/cli/langgraph_cli/config.py +++ b/libs/cli/langgraph_cli/config.py @@ -1162,8 +1162,16 @@ def _build_runtime_env_vars(config: Config) -> list[str]: return env_vars -# These run as part of the install step, before the source would be copied. -_NODE_INSTALL_HOOKS = ("preinstall", "install", "postinstall", "prepare") +# npm runs all of these as part of an install, before the source would be copied. +_NODE_INSTALL_HOOKS = ( + "preinstall", + "install", + "postinstall", + "prepublish", + "preprepare", + "prepare", + "postprepare", +) def _splittable_node_manifests( diff --git a/libs/cli/tests/unit_tests/test_config.py b/libs/cli/tests/unit_tests/test_config.py index c6957b0a2..f8f439b98 100644 --- a/libs/cli/tests/unit_tests/test_config.py +++ b/libs/cli/tests/unit_tests/test_config.py @@ -3531,7 +3531,16 @@ class TestNodeDependencyLayerOrdering: ) @pytest.mark.parametrize( - "hook", ["preinstall", "install", "postinstall", "prepare"] + "hook", + [ + "preinstall", + "install", + "postinstall", + "prepublish", + "preprepare", + "prepare", + "postprepare", + ], ) def test_install_hook_keeps_source_first( self, tmp_path: pathlib.Path, hook: str