mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-08-17 03:40:23 +03:00
fix(cli/info): fix crash when checking node version (#9412)
closes #9396
This commit is contained in:
parent
cd23bb2ca2
commit
9331435a50
6
.changes/tauri-info-no-node.md
Normal file
6
.changes/tauri-info-no-node.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri-cli": "patch:bug"
|
||||
"@tauri-apps/cli": "patch:bug"
|
||||
---
|
||||
|
||||
Fix `tauri info` crashing when Node.js is not installed.
|
@ -42,17 +42,17 @@ pub fn items(metadata: &VersionMetadata) -> Vec<SectionItem> {
|
||||
.unwrap_or_default()
|
||||
.trim();
|
||||
ActionResult::Description(format!("node: {}{}", v, {
|
||||
let version = semver::Version::parse(v).unwrap();
|
||||
let target_version = semver::Version::parse(node_target_ver.as_str()).unwrap();
|
||||
if version < target_version {
|
||||
format!(
|
||||
" ({}, latest: {})",
|
||||
"outdated".red(),
|
||||
target_version.to_string().green()
|
||||
)
|
||||
} else {
|
||||
"".into()
|
||||
}
|
||||
let version = semver::Version::parse(v);
|
||||
let target_version = semver::Version::parse(node_target_ver.as_str());
|
||||
match (version, target_version) {
|
||||
(Ok(version), Ok(target_version)) if version < target_version => {
|
||||
format!(
|
||||
" ({}, latest: {})",
|
||||
"outdated".red(),
|
||||
target_version.to_string().green()
|
||||
)
|
||||
}
|
||||
_ => "".into(),
|
||||
}))
|
||||
} else {
|
||||
ActionResult::None
|
||||
|
Loading…
Reference in New Issue
Block a user