From 87ad7e943abfe587a21f710e682bc898761f0c74 Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Wed, 11 Oct 2023 11:37:59 -0700 Subject: [PATCH] fix: Rework feature deps. --- CHANGELOG.md | 7 +++++++ crates/config/Cargo.toml | 30 +++++++++++++++++++++--------- crates/config/src/config/mod.rs | 9 +++++++++ crates/config/src/lib.rs | 9 --------- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 595f5182..8c3b0981 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Unreleased + +#### ⚙️ Internal + +- Reworked dependencies and features so that some dependencies only enable when a feature is + enabled. + ## 0.12.2 #### 🚀 Updates diff --git a/crates/config/Cargo.toml b/crates/config/Cargo.toml index 2ed8ed59..273a816f 100644 --- a/crates/config/Cargo.toml +++ b/crates/config/Cargo.toml @@ -18,15 +18,21 @@ all-features = true [dependencies] schematic_macros = { version = "0.12.2", path = "../macros" } schematic_types = { version = "0.4.8", path = "../types" } -garde = { version = "0.15.0", default-features = false, features = ["regex"] } -indexmap = "2.0.2" miette = { workspace = true } -serde = { workspace = true } -serde_path_to_error = "0.1.14" -starbase_styles = "0.1.16" thiserror = "1.0.49" tracing = "0.1.37" +# config +garde = { version = "0.15.0", default-features = false, optional = true, features = [ + "regex", +] } +serde = { workspace = true, optional = true } +serde_path_to_error = { version = "0.1.14", optional = true } +starbase_styles = { version = "0.1.16", optional = true } + +# schema +indexmap = { version = "2.0.2", optional = true } + # json serde_json = { version = "1.0.107", optional = true } @@ -40,16 +46,22 @@ toml = { version = "0.8.2", optional = true } serde_yaml = { version = "0.9.25", optional = true } # url -reqwest = { version = "0.11.22", default-features = false, features = [ +reqwest = { version = "0.11.22", default-features = false, optional = true, features = [ "blocking", -], optional = true } +] } [features] default = ["config", "url"] -config = ["schematic_macros/config"] +config = [ + "dep:garde", + "dep:serde", + "dep:serde_path_to_error", + "dep:starbase_styles", + "schematic_macros/config", +] json = ["dep:serde_json"] json_schema = ["dep:schemars", "json", "schema"] -schema = ["schematic_macros/schema"] +schema = ["dep:indexmap", "schematic_macros/schema"] toml = ["dep:toml"] typescript = ["schema"] url = ["dep:reqwest"] diff --git a/crates/config/src/config/mod.rs b/crates/config/src/config/mod.rs index ab2a152f..ac18d64e 100644 --- a/crates/config/src/config/mod.rs +++ b/crates/config/src/config/mod.rs @@ -17,3 +17,12 @@ pub use loader::*; pub use path::*; pub use source::*; pub use validator::*; + +#[macro_export] +macro_rules! derive_enum { + ($impl:item) => { + #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] + #[serde(rename_all = "kebab-case")] + $impl + }; +} diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index 33efdfb7..e3261778 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -31,12 +31,3 @@ pub use config::*; pub use schematic_macros::*; pub use schematic_types::{SchemaField, SchemaType, Schematic}; - -#[macro_export] -macro_rules! derive_enum { - ($impl:item) => { - #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] - #[serde(rename_all = "kebab-case")] - $impl - }; -}