From 1cdf5765cfc67e3b54b5e187d322fcdef8a75253 Mon Sep 17 00:00:00 2001 From: Myrddin Dundragon Date: Thu, 4 Sep 2025 12:20:48 -0400 Subject: [PATCH] Made it so that database usage can be skipped. When using dioxus it would be greate to use the types from this library on the backend and the front end. To do this we need to be able to cut out the sqlx package because it uses mio which doesn't compile to WASM. To do this we put the database code behind a database feature flag. The Publisher feature will also trigger the database flag. --- tavern/Cargo.toml | 8 +++++--- tavern/src/lib.rs | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tavern/Cargo.toml b/tavern/Cargo.toml index 96cfa91..cb9521f 100644 --- a/tavern/Cargo.toml +++ b/tavern/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tavern" -version = "0.2.4" +version = "0.2.5" edition = "2024" description = "A blogging system that will allow you to write your blog in Markdown and then display it in HTML using Dioxus." repository = "/CyberMages/tavern" @@ -14,7 +14,7 @@ license = "Apache-2.0" chrono = { version = "0.4.41", features = ["serde"] } pulldown-cmark = "0.13.0" serde = { version = "1.0.219", features = ["derive"] } -sqlx = { version = "0.8.6", features = ["sqlite", "chrono", "runtime-tokio"] } +sqlx = { version = "0.8.6", features = ["sqlite", "chrono", "runtime-tokio"], optional = true} toml = "0.9.5" [dev-dependencies] @@ -23,4 +23,6 @@ tokio = { version = "1", features = ["full"] } [features] -publisher = [] +default = [] +database = ["sqlx"] +publisher = ["database"] diff --git a/tavern/src/lib.rs b/tavern/src/lib.rs index 1e86806..fc9d6a2 100644 --- a/tavern/src/lib.rs +++ b/tavern/src/lib.rs @@ -6,6 +6,7 @@ mod info; mod adventurer; #[cfg(feature = "publisher")] mod converter; +#[cfg(feature = "database")] mod database; mod tale; mod tavern; @@ -13,6 +14,7 @@ mod tavern; pub use crate::adventurer::{Adventurer, Legend}; +#[cfg(feature = "database")] pub use crate::database::Database; pub use crate::info::{get_name, get_version}; pub use crate::tale::{Lore, Tale};