Skip to content

Commit

Permalink
default dependency version comparison to GreaterEq instead of Caret
Browse files Browse the repository at this point in the history
fixes #64
  • Loading branch information
matcool committed Jun 30, 2024
1 parent 0b31d79 commit b4d3a41
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/util/mod_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,20 @@ where
{
// semver doesn't accept "v" prefixes and the string will be validated at
// runtime by Geode anyway so let's just crudely remove all 'v's for now
VersionReq::parse(&<String>::deserialize(deserializer)?.replace('v', ""))
let str = <String>::deserialize(deserializer)?.replace('v', "");
// semver defaults to ^, geode defaults to >=
let actual_equal = str.starts_with('=');
VersionReq::parse(&str)
.map_err(serde::de::Error::custom)
.map(|mut v| {
// in practice there should only be one comparator.. oh well
for c in &mut v.comparators {
if c.op == semver::Op::Caret && !actual_equal {
c.op = semver::Op::GreaterEq;
}
}
v
})
}

pub trait ToGeodeString {
Expand Down

0 comments on commit b4d3a41

Please sign in to comment.