Skip to content

Commit

Permalink
docs: add comment explaining why we need to check ^ and override th…
Browse files Browse the repository at this point in the history
…e comparator operation
  • Loading branch information
ologbonowiwi committed Oct 8, 2024
1 parent ab0ba60 commit f096df6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ fn check_semver_version(range_requirement: &str, actual: &str) -> bool {
return;
};

// semver crate handles "1.0.0" as "^1.0.0", and we want to treat it as "=1.0.0"
// because of this, we need to iterate over the comparators, and change each one
// that has "default caret operator" to an exact operator
// this condition overrides the "default caret operator" of semver create.
if !requirement.starts_with('^') && comparator.op == semver::Op::Caret {
comparator.op = semver::Op::Exact;
}
Expand Down

0 comments on commit f096df6

Please sign in to comment.