diff --git a/git-cliff/Cargo.toml b/git-cliff/Cargo.toml index 58ff376..aaba03a 100644 --- a/git-cliff/Cargo.toml +++ b/git-cliff/Cargo.toml @@ -16,12 +16,15 @@ edition = "2021" name = "git-cliff-completions" path = "src/bin/completions.rs" +[features] +# check for new versions +default = ["update-informer"] + [dependencies] pretty_env_logger = "0.4.0" log = "0.4.14" dirs-next = "2.0.0" clap_complete = "3.1.1" -update-informer = "0.5.0" [dependencies.git-cliff-core] version = "0.6.1" # managed by release.sh @@ -31,5 +34,9 @@ path = "../git-cliff-core" version = "3.1.6" features = ["derive", "env", "wrap_help"] +[dependencies.update-informer] +version = "0.5.0" +optional = true + [dev-dependencies] pretty_assertions = "1.1.0" diff --git a/git-cliff/src/lib.rs b/git-cliff/src/lib.rs index b4b35de..82114a3 100644 --- a/git-cliff/src/lib.rs +++ b/git-cliff/src/lib.rs @@ -29,14 +29,18 @@ use std::fs::{ File, }; use std::io; -use update_informer::registry::Crates; -use update_informer::Check; /// Checks for a new version on crates.io +#[cfg(feature = "update-informer")] fn check_new_version() { + use update_informer::Check; let pkg_name = env!("CARGO_PKG_NAME"); let pkg_version = env!("CARGO_PKG_VERSION"); - let informer = update_informer::new(Crates, pkg_name, pkg_version); + let informer = update_informer::new( + update_informer::registry::Crates, + pkg_name, + pkg_version, + ); if let Some(new_version) = informer.check_version().ok().flatten() { log::info!( "A new version of {pkg_name} is available: v{pkg_version} -> \ @@ -48,6 +52,7 @@ fn check_new_version() { /// Runs `git-cliff`. pub fn run(mut args: Opt) -> Result<()> { // Check if there is a new version available. + #[cfg(feature = "update-informer")] check_new_version(); // Create the configuration file if init flag is given.