diff --git a/sea-orm-cli/Cargo.toml b/sea-orm-cli/Cargo.toml index 70a645ff..f40d0fd6 100644 --- a/sea-orm-cli/Cargo.toml +++ b/sea-orm-cli/Cargo.toml @@ -4,14 +4,14 @@ [package] name = "sea-orm-cli" version = "0.10.0" -authors = [ "Billy Chan " ] +authors = ["Billy Chan "] edition = "2021" description = "Command line utility for SeaORM" license = "MIT OR Apache-2.0" homepage = "https://www.sea-ql.org/SeaORM" documentation = "https://docs.rs/sea-orm" repository = "https://github.com/SeaQL/sea-orm" -categories = [ "database" ] +categories = ["database"] keywords = ["async", "orm", "mysql", "postgres", "sqlite"] default-run = "sea-orm-cli" rust-version = "1.60" @@ -23,20 +23,20 @@ path = "src/lib.rs" [[bin]] name = "sea-orm-cli" path = "src/bin/main.rs" -required-features = ["codegen"] +required-features = ["cli", "codegen"] [[bin]] name = "sea" path = "src/bin/sea.rs" -required-features = ["codegen"] +required-features = ["cli", "codegen"] [dependencies] -clap = { version = "^3.2", features = ["env", "derive"] } +clap = { version = "^3.2", features = ["env", "derive"], optional = true } dotenvy = { version = "^0.15", optional = true } -async-std = { version = "^1.9", features = [ "attributes", "tokio1" ], optional = true } +async-std = { version = "^1.9", features = ["attributes", "tokio1"], optional = true } sea-orm-codegen = { version = "^0.10.0", path = "../sea-orm-codegen", optional = true } sea-schema = { version = "^0.10.2", git = "https://github.com/SeaQL/sea-schema" } -sqlx = { version = "^0.6", default-features = false, features = [ "mysql", "postgres" ], optional = true } +sqlx = { version = "^0.6", default-features = false, features = ["mysql", "postgres"], optional = true } tracing-subscriber = { version = "0.3", features = ["env-filter"] } tracing = { version = "0.1" } url = "^2.2" @@ -47,11 +47,12 @@ regex = "1" smol = "1.2.5" [features] -default = [ "codegen", "runtime-async-std-native-tls", "dotenvy", "async-std" ] -codegen = [ "sea-schema/sqlx-all", "sea-orm-codegen" ] -runtime-actix-native-tls = [ "sqlx/runtime-actix-native-tls", "sea-schema/runtime-actix-native-tls" ] -runtime-async-std-native-tls = [ "sqlx/runtime-async-std-native-tls", "sea-schema/runtime-async-std-native-tls" ] -runtime-tokio-native-tls = [ "sqlx/runtime-tokio-native-tls", "sea-schema/runtime-tokio-native-tls" ] -runtime-actix-rustls = [ "sqlx/runtime-actix-rustls", "sea-schema/runtime-actix-rustls" ] -runtime-async-std-rustls = [ "sqlx/runtime-async-std-rustls", "sea-schema/runtime-async-std-rustls" ] -runtime-tokio-rustls = [ "sqlx/runtime-tokio-rustls", "sea-schema/runtime-tokio-rustls" ] +default = ["codegen", "cli", "runtime-async-std-native-tls", "async-std"] +codegen = ["sea-schema/sqlx-all", "sea-orm-codegen"] +cli = ["clap", "dotenvy"] +runtime-actix-native-tls = ["sqlx/runtime-actix-native-tls", "sea-schema/runtime-actix-native-tls"] +runtime-async-std-native-tls = ["sqlx/runtime-async-std-native-tls", "sea-schema/runtime-async-std-native-tls"] +runtime-tokio-native-tls = ["sqlx/runtime-tokio-native-tls", "sea-schema/runtime-tokio-native-tls"] +runtime-actix-rustls = ["sqlx/runtime-actix-rustls", "sea-schema/runtime-actix-rustls"] +runtime-async-std-rustls = ["sqlx/runtime-async-std-rustls", "sea-schema/runtime-async-std-rustls"] +runtime-tokio-rustls = ["sqlx/runtime-tokio-rustls", "sea-schema/runtime-tokio-rustls"] diff --git a/sea-orm-cli/src/commands/migrate.rs b/sea-orm-cli/src/commands/migrate.rs index 980d22b8..28d48dfd 100644 --- a/sea-orm-cli/src/commands/migrate.rs +++ b/sea-orm-cli/src/commands/migrate.rs @@ -8,8 +8,10 @@ use std::{ process::Command, }; +#[cfg(feature = "cli")] use crate::MigrateSubcommands; +#[cfg(feature = "cli")] pub fn run_migrate_command( command: Option, migration_dir: &str, diff --git a/sea-orm-cli/src/lib.rs b/sea-orm-cli/src/lib.rs index 366b8fa6..4cbb2970 100644 --- a/sea-orm-cli/src/lib.rs +++ b/sea-orm-cli/src/lib.rs @@ -1,5 +1,7 @@ +#[cfg(feature = "cli")] pub mod cli; pub mod commands; +#[cfg(feature = "cli")] pub use cli::*; pub use commands::*; diff --git a/sea-orm-migration/Cargo.toml b/sea-orm-migration/Cargo.toml index 89fe83ec..28f4e14c 100644 --- a/sea-orm-migration/Cargo.toml +++ b/sea-orm-migration/Cargo.toml @@ -4,14 +4,14 @@ [package] name = "sea-orm-migration" version = "0.10.0" -authors = [ "Billy Chan " ] +authors = ["Billy Chan "] edition = "2021" description = "Migration utility for SeaORM" license = "MIT OR Apache-2.0" homepage = "https://www.sea-ql.org/SeaORM" documentation = "https://docs.rs/sea-orm" repository = "https://github.com/SeaQL/sea-orm" -categories = [ "database" ] +categories = ["database"] keywords = ["async", "orm", "mysql", "postgres", "sqlite"] rust-version = "1.60" @@ -21,10 +21,10 @@ path = "src/lib.rs" [dependencies] async-trait = { version = "^0.1" } -clap = { version = "^3.2", features = ["env", "derive"] } -dotenvy = { version = "^0.15" } +clap = { version = "^3.2", features = ["env", "derive"], optional = true } +dotenvy = { version = "^0.15", optional = true } sea-orm = { version = "^0.10.0", path = "../", default-features = false, features = ["macros"] } -sea-orm-cli = { version = "^0.10.0", path = "../sea-orm-cli", default-features = false } +sea-orm-cli = { version = "^0.10.0", path = "../sea-orm-cli", default-features = false, optional = true } sea-schema = { version = "^0.10.2", git = "https://github.com/SeaQL/sea-schema" } tracing = { version = "0.1", features = ["log"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } @@ -33,12 +33,14 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] } async-std = { version = "^1", features = ["attributes", "tokio1"] } [features] +default = ["cli"] +cli = ["clap", "dotenvy", "sea-orm-cli/cli"] sqlx-mysql = ["sea-orm/sqlx-mysql"] sqlx-postgres = ["sea-orm/sqlx-postgres"] sqlx-sqlite = ["sea-orm/sqlx-sqlite"] -runtime-actix-native-tls = [ "sea-orm/runtime-actix-native-tls" ] -runtime-async-std-native-tls = [ "sea-orm/runtime-async-std-native-tls" ] -runtime-tokio-native-tls = [ "sea-orm/runtime-tokio-native-tls" ] -runtime-actix-rustls = [ "sea-orm/runtime-actix-rustls" ] -runtime-async-std-rustls = [ "sea-orm/runtime-async-std-rustls" ] -runtime-tokio-rustls = [ "sea-orm/runtime-tokio-rustls" ] +runtime-actix-native-tls = ["sea-orm/runtime-actix-native-tls"] +runtime-async-std-native-tls = ["sea-orm/runtime-async-std-native-tls"] +runtime-tokio-native-tls = ["sea-orm/runtime-tokio-native-tls"] +runtime-actix-rustls = ["sea-orm/runtime-actix-rustls"] +runtime-async-std-rustls = ["sea-orm/runtime-async-std-rustls"] +runtime-tokio-rustls = ["sea-orm/runtime-tokio-rustls"] diff --git a/sea-orm-migration/src/lib.rs b/sea-orm-migration/src/lib.rs index 53b51342..6a7f8547 100644 --- a/sea-orm-migration/src/lib.rs +++ b/sea-orm-migration/src/lib.rs @@ -1,3 +1,4 @@ +#[cfg(feature = "cli")] pub mod cli; pub mod manager; pub mod migrator; diff --git a/sea-orm-migration/src/prelude.rs b/sea-orm-migration/src/prelude.rs index 836ab168..fd78117e 100644 --- a/sea-orm-migration/src/prelude.rs +++ b/sea-orm-migration/src/prelude.rs @@ -1,4 +1,6 @@ +#[cfg(feature = "cli")] pub use super::cli; + pub use super::manager::SchemaManager; pub use super::migrator::MigratorTrait; pub use super::{MigrationName, MigrationTrait};