From b4d3a41dad8849d1c4d5dc9b79e3b3bbc95feccc Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sun, 30 Jun 2024 14:47:34 -0300 Subject: [PATCH] default dependency version comparison to GreaterEq instead of Caret fixes #64 --- src/util/mod_file.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/util/mod_file.rs b/src/util/mod_file.rs index 3714492..4544260 100644 --- a/src/util/mod_file.rs +++ b/src/util/mod_file.rs @@ -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(&::deserialize(deserializer)?.replace('v', "")) + let str = ::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 {