Skip to content

Commit

Permalink
fix: allow no empty dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mysteryven committed Aug 14, 2024
1 parent 1179f38 commit 0d84c52
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: CI


on:
workflow_dispatch:
pull_request:
Expand Down
1 change: 1 addition & 0 deletions src/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::Atom;

#[derive(Debug, Deserialize)]
pub struct PackageJSON {
#[serde(default)]
dependencies: FxHashMap<Atom, Atom>,
}

Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ impl DepClean {
package_json_container.compute_unused_deps(&used_deps);
let unused_deps = package_json_container.unused_dependencies();
let elapsed = start.elapsed().as_millis();
let time_text = format!("Checked {} file(s) in {}ms.", paths.len(), elapsed).dark_gray();

if unused_deps.is_empty() {
println!("{:?}", "No unused dependency, Good!".rainbow());
println!("No unused dependency.");
println!("\n{time_text}");
std::process::exit(0);
}

Expand Down Expand Up @@ -113,8 +115,6 @@ impl DepClean {
)
.green();

let time_text = format!("Checked {} file(s) in {}ms.", paths.len(), elapsed).dark_gray();

println!("{dep_text}\n\n{}\n{}", time_text, footer);
std::process::exit(1);
}
Expand Down

0 comments on commit 0d84c52

Please sign in to comment.