Skip to content

Commit

Permalink
fix(cli.rs): fix tauri info panic when a package isn't installed, c…
Browse files Browse the repository at this point in the history
…loses #3985 (#3996)
  • Loading branch information
amrbashir authored Apr 29, 2022
1 parent 094534d commit 4f0f318
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
6 changes: 6 additions & 0 deletions .changes/cli.rs-info-panic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"cli.rs": patch
"cli.js": patch
---

Fix `tauri info` panic when a pacakage isn't installed.
2 changes: 1 addition & 1 deletion tooling/cli/metadata.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
10 changes: 1 addition & 9 deletions tooling/cli/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,6 @@ struct VersionBlock {
version: String,
target_version: String,
indentation: usize,
skip_update_check: bool,
}

impl VersionBlock {
Expand All @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 4f0f318

Please sign in to comment.