Skip to content

Commit 5877c69

Browse files
authored
Fixes semver comparison (#251)
The fix in #230 changed the `6.0.0-0` comparison into `6.0.0`. I was thinking that `check_ignore_rc` would ignore all RCs, but it's a little stricter than I thought and still took into account the one from the original range (in other words, it accepts `7.0.0-rc`, but it still requires the version to be greater than `6.0.0`). This diff fixes that by reverting to `6.0.0-0` which, together with `check_ignore_rc`, provides the right result.
1 parent 16a4f84 commit 5877c69

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/zpm-switch/src/install.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ pub async fn install_package_manager(package_manager: &VersionPackageManagerRefe
160160
platform: get_system_string().to_string(),
161161
};
162162

163-
if zpm_semver::Range::from_file_string(">=6.0.0").unwrap().check_ignore_rc(&package_manager.version) {
163+
if zpm_semver::Range::from_file_string(">=6.0.0-0").unwrap().check_ignore_rc(&package_manager.version) {
164164
return install_native_from_zpm(&version_platform, &Path::from_str("yarn-bin").unwrap()).await;
165165
}
166166

167-
if zpm_semver::Range::from_file_string(">=2.0.0").unwrap().check_ignore_rc(&package_manager.version) {
167+
if zpm_semver::Range::from_file_string(">=2.0.0-0").unwrap().check_ignore_rc(&package_manager.version) {
168168
return install_node_js_from_url(&version_platform).await;
169169
}
170170

171-
if zpm_semver::Range::from_file_string(">=0.0.0").unwrap().check_ignore_rc(&package_manager.version) {
171+
if zpm_semver::Range::from_file_string(">=0.0.0-0").unwrap().check_ignore_rc(&package_manager.version) {
172172
return install_node_js_from_package(&version_platform, &Path::from_str("bin/yarn.js").unwrap()).await;
173173
}
174174

0 commit comments

Comments
 (0)