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.
This commit is contained in:
2025-09-04 12:20:48 -04:00
parent 877d7e15a3
commit 1cdf5765cf
2 changed files with 7 additions and 3 deletions

View File

@ -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"]

View File

@ -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};