Эх сурвалжийг харах

fix(cli.rs): fix `tauri info` panic when a package isn't installed, closes #3985 (#3996)

Amr Bashir 3 жил өмнө
parent
commit
4f0f3187c9

+ 6 - 0
.changes/cli.rs-info-panic.md

@@ -0,0 +1,6 @@
+---
+"cli.rs": patch
+"cli.js": patch
+---
+
+Fix `tauri info` panic when a pacakage isn't installed.

+ 1 - 1
tooling/cli/metadata.json

@@ -1,7 +1,7 @@
 {
   "cli.js": {
     "version": "1.0.0-rc.9",
-    "node": ">= 10"
+    "node": ">= 10.0.0"
   },
   "tauri": "1.0.0-rc.8",
   "tauri-build": "1.0.0-rc.7"

+ 1 - 9
tooling/cli/src/info.rs

@@ -494,7 +494,6 @@ struct VersionBlock {
   version: String,
   target_version: String,
   indentation: usize,
-  skip_update_check: bool,
 }
 
 impl VersionBlock {
@@ -504,15 +503,9 @@ impl VersionBlock {
       version: version.into(),
       target_version: "".into(),
       indentation: 2,
-      skip_update_check: false,
     }
   }
 
-  fn skip_update_check(mut self) -> Self {
-    self.skip_update_check = true;
-    self
-  }
-
   fn target_version(mut self, version: impl Into<String>) -> Self {
     self.target_version = version.into();
     self
@@ -531,7 +524,7 @@ impl VersionBlock {
         self.version.clone()
       }
     );
-    if !self.target_version.is_empty() && !self.skip_update_check {
+    if !(self.version.is_empty() || self.target_version.is_empty()) {
       let version = semver::Version::parse(self.version.as_str()).unwrap();
       let target_version = semver::Version::parse(self.target_version.as_str()).unwrap();
       if version < target_version {
@@ -630,7 +623,6 @@ pub fn command(_options: Options) -> Result<()> {
       .collect::<String>(),
   )
   .target_version(metadata.js_cli.node.replace(">= ", ""))
-  .skip_update_check()
   .display();
 
   VersionBlock::new(