Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(npm): remove undocumented workspace tag special case #87

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions src/workspace/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,20 +391,16 @@ impl WorkspaceResolver {
&self,
pkg_req: &PackageReq,
) -> Option<&Path> {
let result = self
if pkg_req.version_req.tag().is_some() {
return None;
}

self
.resolve_workspace_pkg_json_folder_for_pkg_json_dep(
&pkg_req.name,
&pkg_req.version_req,
)
.ok()?;

if let Some(tag) = pkg_req.version_req.tag() {
if tag != "workspace" {
return None;
}
}

Some(result)
.ok()
}

pub fn resolve_workspace_pkg_json_folder_for_pkg_json_dep(
Expand Down Expand Up @@ -690,8 +686,8 @@ mod test {
root_dir().join("no-version")
);

assert_eq!(resolve("@scope/a@workspace").unwrap(), root_dir().join("a"));
// difference is here, it won't match for a non-workspace tag for an npm specifier
// won't match for tags
assert_eq!(resolve("@scope/a@workspace"), None);
assert_eq!(resolve("@scope/a@latest"), None);
}
}
Expand Down