From cb74975ab2b88a984c11a9bbb33ff2a36ccb2acb Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:11:43 -0700 Subject: fix(install): compare versions directly to decide whether to create a child node_modules dir for a workspace member (#26001) Fixes #25861. Previously we were attempting to match the version requirement against the version already present in `node_modules` root, and if they didn't match we would create a node_modules dir in the workspace member's directory with the dependency. Aside from the fact that this caused the panic, on second thought it just doesn't make sense in general. We shouldn't be semver matching, as resolution has already occurred and decided what package versions are required. Instead, we can just compare the versions directly. --- tests/specs/install/workspace_member_with_tag_dep/__test__.jsonc | 9 +++++++++ tests/specs/install/workspace_member_with_tag_dep/install.out | 3 +++ tests/specs/install/workspace_member_with_tag_dep/package.json | 6 ++++++ .../install/workspace_member_with_tag_dep/package1/package.json | 5 +++++ 4 files changed, 23 insertions(+) create mode 100644 tests/specs/install/workspace_member_with_tag_dep/__test__.jsonc create mode 100644 tests/specs/install/workspace_member_with_tag_dep/install.out create mode 100644 tests/specs/install/workspace_member_with_tag_dep/package.json create mode 100644 tests/specs/install/workspace_member_with_tag_dep/package1/package.json (limited to 'tests') diff --git a/tests/specs/install/workspace_member_with_tag_dep/__test__.jsonc b/tests/specs/install/workspace_member_with_tag_dep/__test__.jsonc new file mode 100644 index 000000000..254fe8b98 --- /dev/null +++ b/tests/specs/install/workspace_member_with_tag_dep/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "install", + "output": "install.out" + } + ] +} diff --git a/tests/specs/install/workspace_member_with_tag_dep/install.out b/tests/specs/install/workspace_member_with_tag_dep/install.out new file mode 100644 index 000000000..b8114c12a --- /dev/null +++ b/tests/specs/install/workspace_member_with_tag_dep/install.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/esm-basic +Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz +Initialize @denotest/esm-basic@1.0.0 diff --git a/tests/specs/install/workspace_member_with_tag_dep/package.json b/tests/specs/install/workspace_member_with_tag_dep/package.json new file mode 100644 index 000000000..58aa5d5cc --- /dev/null +++ b/tests/specs/install/workspace_member_with_tag_dep/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "@denotest/esm-basic": "latest" + }, + "workspaces": ["package1"] +} diff --git a/tests/specs/install/workspace_member_with_tag_dep/package1/package.json b/tests/specs/install/workspace_member_with_tag_dep/package1/package.json new file mode 100644 index 000000000..150a7df6a --- /dev/null +++ b/tests/specs/install/workspace_member_with_tag_dep/package1/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "latest" + } +} -- cgit v1.2.3