refactor(workspace): reorganize cargo workspace (#12)

This commit is contained in:
Alexandre Pasmantier 2024-11-11 15:15:24 +01:00 committed by GitHub
parent 7bc6f29c30
commit 5611ee8b2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
47 changed files with 182 additions and 205 deletions

View File

@ -105,7 +105,7 @@ As such, channels can virtually be anything that can respond to a user query and
When contributing a new channel, you should create a new module in the `television_channels` crate with a new struct for
your channel that implements the `OnAir` trait.
```rust
// crates/television_channels/src/channels/my_new_channel.rs
// crates/television-channels/src/channels/my_new_channel.rs
use television_channels::channels::OnAir;
@ -118,7 +118,7 @@ impl OnAir for MyNewChannel {
You should also add your channel to the `TelevisionChannel` enum in the `television_channels` crate.
```rust
// crates/television_channels/src/channels.rs
// crates/television-channels/src/channels.rs
#[derive(ToUnitChannel, ToCliChannel, Broadcast)]
pub enum TelevisionChannel {

14
Cargo.lock generated
View File

@ -46,9 +46,9 @@ dependencies = [
[[package]]
name = "allocator-api2"
version = "0.2.19"
version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "611cc2ae7d2e242c457e4be7f97036b8ad9ca152b499f53faf99b1ed8fc2553f"
checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9"
[[package]]
name = "ansi_colours"
@ -2963,7 +2963,7 @@ dependencies = [
[[package]]
name = "television"
version = "0.4.19"
version = "0.4.20"
dependencies = [
"anyhow",
"better-panic",
@ -3011,7 +3011,7 @@ dependencies = [
[[package]]
name = "television-channels"
version = "0.0.1"
version = "0.0.0"
dependencies = [
"clap",
"color-eyre",
@ -3039,7 +3039,7 @@ dependencies = [
[[package]]
name = "television-fuzzy"
version = "0.0.1"
version = "0.0.0"
dependencies = [
"nucleo",
"parking_lot",
@ -3047,7 +3047,7 @@ dependencies = [
[[package]]
name = "television-previewers"
version = "0.0.1"
version = "0.0.0"
dependencies = [
"color-eyre",
"devicons",
@ -3063,7 +3063,7 @@ dependencies = [
[[package]]
name = "television-utils"
version = "0.0.1"
version = "0.0.0"
dependencies = [
"bat",
"color-eyre",

View File

@ -1,12 +1,13 @@
[package]
name = "television"
version = "0.4.19"
version = "0.4.20"
edition = "2021"
description = "The revolution will be televised."
license = "MIT"
authors = ["Alexandre Pasmantier <alex.pasmant@gmail.com>"]
build = "build.rs"
repository = "https://github.com/alexpasmantier/television"
homepage = "https://github.com/alexpasmantier/television"
keywords = ["search", "fuzzy", "preview", "tui", "terminal"]
categories = [
"command-line-utilities",
@ -15,22 +16,19 @@ categories = [
"development-tools",
]
include = ["LICENSE", "README.md", "crates/television/**/*.rs", "build.rs"]
rust-version = "1.80.0"
[[bin]]
bench = false
path = "crates/television/main.rs"
name = "tv"
[workspace]
members = ["crates/television_channels","crates/television_derive", "crates/television_fuzzy", "crates/television_previewers", "crates/television_utils"]
[dependencies]
television-fuzzy = { version = "0.0.1", path = "crates/television_fuzzy" }
television-derive = { version = "0.0.0", path = "crates/television_derive" }
television-channels = { version = "0.0.1", path = "crates/television_channels" }
television-previewers = { version = "0.0.1", path = "crates/television_previewers" }
television-utils = { version = "0.0.1", path = "crates/television_utils" }
television-fuzzy = { workspace = true }
television-derive = { workspace = true}
television-channels = { workspace = true}
television-previewers = { workspace = true}
television-utils = { workspace = true}
better-panic = "0.3.0"
clap = { version = "4.4.5", features = [
"derive",
@ -73,12 +71,43 @@ human-panic = "2.0.2"
pretty_assertions = "1.4.1"
termtree = "0.5.1"
copypasta = "0.10.1"
[build-dependencies]
anyhow = "1.0.86"
vergen-gix = { version = "1.0.0", features = ["build", "cargo", "rustc"] }
[target.'cfg(target_os = "macos")'.dependencies]
crossterm = { version = "0.28.1", features = ["serde", "use-dev-tty"] }
[workspace]
resolver = "2"
members = ["crates/television-channels", "crates/television-derive", "crates/television-fuzzy", "crates/television-previewers", "crates/television-utils"]
[workspace.dependencies]
television-derive = { path = "crates/television-derive" }
television-fuzzy = { path = "crates/television-fuzzy" }
television-previewers = { path = "crates/television-previewers" }
television-utils = { path = "crates/television-utils" }
television-channels = { path = "crates/television-channels" }
[workspace.package]
edition = "2021"
description = "The revolution will be televised."
license = "MIT"
authors = ["Alexandre Pasmantier <alex.pasmant@gmail.com>"]
build = "build.rs"
repository = "https://github.com/alexpasmantier/television"
homepage = "https://github.com/alexpasmantier/television"
keywords = ["search", "fuzzy", "preview", "tui", "terminal"]
categories = [
"command-line-utilities",
"command-line-interface",
"concurrency",
"development-tools",
]
include = ["LICENSE", "README.md", "crates/television/**/*.rs", "build.rs"]
rust-version = "1.80.0"
[profile.staging]
inherits = "dev"
@ -93,6 +122,3 @@ debug = true
[profile.release]
lto = "thin"
[target.'cfg(target_os = "macos")'.dependencies]
crossterm = { version = "0.28.1", features = ["serde", "use-dev-tty"] }

View File

@ -0,0 +1,30 @@
[package]
name = "television-channels"
version = "0.0.0"
authors.workspace = true
repository.workspace = true
homepage.workspace = true
keywords.workspace = true
categories.workspace = true
readme.workspace = true
license.workspace = true
include.workspace = true
edition.workspace = true
rust-version.workspace = true
publish = false
[dependencies]
television-fuzzy = {workspace = true}
television-utils = {workspace = true}
television-derive = {workspace = true}
devicons = "0.6.11"
tracing = "0.1.40"
eyre = "0.6.12"
ignore = "0.4.23"
tokio = { version = "1.41.1", features = ["rt"] }
clap = { version = "4.5.20", features = ["derive"] }
directories = "5.0.1"
color-eyre = "0.6.3"
serde = "1.0.214"
strum = { version = "0.26.3", features = ["derive"] }

View File

@ -0,0 +1,24 @@
[package]
name = "television-derive"
version = "0.0.0"
authors.workspace = true
repository.workspace = true
homepage.workspace = true
keywords.workspace = true
categories.workspace = true
readme.workspace = true
license.workspace = true
include.workspace = true
edition.workspace = true
rust-version.workspace = true
publish = false
[dependencies]
proc-macro2 = "1.0.87"
quote = "1.0.37"
syn = "2.0.79"
[lib]
proc-macro = true

View File

@ -6,7 +6,7 @@ use quote::quote;
///
/// ```ignore
/// use crate::channels::{TelevisionChannel, OnAir};
/// use television_derive::ToCliChannel;
/// use television-derive::ToCliChannel;
/// use crate::channels::{files, text};
///
/// #[derive(ToCliChannel)]
@ -123,7 +123,7 @@ fn impl_cli_channel(ast: &syn::DeriveInput) -> TokenStream {
///
/// Example:
/// ```ignore
/// use television_derive::Broadcast;
/// use television-derive::Broadcast;
/// use crate::channels::{TelevisionChannel, OnAir};
/// use crate::channels::{files, text};
///

View File

@ -0,0 +1,18 @@
[package]
name = "television-fuzzy"
version = "0.0.0"
authors.workspace = true
repository.workspace = true
homepage.workspace = true
keywords.workspace = true
categories.workspace = true
readme.workspace = true
license.workspace = true
include.workspace = true
edition.workspace = true
rust-version.workspace = true
publish = false
[dependencies]
nucleo = "0.5.0"
parking_lot = "0.12.3"

View File

@ -61,7 +61,7 @@ impl<T> LazyMutex<T> {
///
/// # Example
/// ```ignore
/// use television_fuzzy::matcher::{lazy::MATCHER, matched_item::MatchedItem};
/// use television-fuzzy::matcher::{lazy::MATCHER, matched_item::MatchedItem};
///
/// let snapshot = channel_matcher.snapshot();
///

View File

@ -0,0 +1,27 @@
[package]
name = "television-previewers"
version = "0.0.0"
authors.workspace = true
repository.workspace = true
homepage.workspace = true
keywords.workspace = true
categories.workspace = true
readme.workspace = true
license.workspace = true
include.workspace = true
edition.workspace = true
rust-version.workspace = true
publish = false
[dependencies]
syntect = "5.2.0"
television-channels = { workspace = true }
television-utils = { workspace = true }
tracing = "0.1.40"
parking_lot = "0.12.3"
tokio = "1.41.1"
termtree = "0.5.1"
devicons = "0.6.11"
color-eyre = "0.6.3"
infer = "0.16.0"

View File

@ -0,0 +1,28 @@
[package]
name = "television-utils"
version = "0.0.0"
authors.workspace = true
repository.workspace = true
homepage.workspace = true
keywords.workspace = true
categories.workspace = true
readme.workspace = true
license.workspace = true
include.workspace = true
edition.workspace = true
rust-version.workspace = true
publish = false
[dependencies]
ignore = "0.4.23"
infer = "0.16.0"
lazy_static = "1.5.0"
tracing = "0.1.40"
color-eyre = "0.6.3"
bat = { version = "0.24.0", default-features = false, features = ["regex-onig"] }
directories = "5.0.1"
syntect = "5.2.0"
gag = "1.0.0"
[target.'cfg(windows)'.dependencies]
winapi-util = "0.1.9"

View File

@ -161,7 +161,7 @@ pub fn get_data_dir() -> PathBuf {
} else if let Some(proj_dirs) = project_directory() {
proj_dirs.data_local_dir().to_path_buf()
} else {
PathBuf::from(".").join(".data")
PathBuf::from("../../../../..").join(".data")
};
directory
}
@ -172,7 +172,7 @@ pub fn get_config_dir() -> PathBuf {
} else if let Some(proj_dirs) = project_directory() {
proj_dirs.config_local_dir().to_path_buf()
} else {
PathBuf::from(".").join(".config")
PathBuf::from("../../../../..").join("../../../../../.config")
};
info!("Using config directory: {:?}", directory);
directory

View File

@ -1,30 +0,0 @@
[package]
name = "television-channels"
version = "0.0.1"
edition = "2021"
description = "The revolution will be televised."
license = "MIT"
authors = ["Alexandre Pasmantier <alex.pasmant@gmail.com>"]
repository = "https://github.com/alexpasmantier/television"
keywords = ["search", "fuzzy", "preview", "tui", "terminal"]
categories = [
"command-line-utilities",
"command-line-interface",
"concurrency",
"development-tools",
]
[dependencies]
television-fuzzy = { path = "../television_fuzzy", version = "0.0.1" }
television-utils = { path = "../television_utils", version = "0.0.1" }
television-derive = { path = "../television_derive", version = "0.0.0" }
devicons = "0.6.11"
tracing = "0.1.40"
eyre = "0.6.12"
ignore = "0.4.23"
tokio = { version = "1.41.1", features = ["rt"] }
clap = { version = "4.5.20", features = ["derive"] }
directories = "5.0.1"
color-eyre = "0.6.3"
serde = "1.0.214"
strum = { version = "0.26.3", features = ["derive"] }

View File

@ -1,46 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "channel_derive"
version = "0.1.0"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "proc-macro2"
version = "1.0.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [
"proc-macro2",
]
[[package]]
name = "syn"
version = "2.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"

View File

@ -1,24 +0,0 @@
[package]
name = "television-derive"
version = "0.0.0"
edition = "2021"
description = "The revolution will be televised."
license = "MIT"
authors = ["Alexandre Pasmantier <alex.pasmant@gmail.com>"]
repository = "https://github.com/alexpasmantier/television"
keywords = ["search", "fuzzy", "preview", "tui", "terminal"]
categories = [
"command-line-utilities",
"command-line-interface",
"concurrency",
"development-tools",
]
[dependencies]
proc-macro2 = "1.0.87"
quote = "1.0.37"
syn = "2.0.79"
[lib]
proc-macro = true

View File

@ -1,19 +0,0 @@
[package]
name = "television-fuzzy"
version = "0.0.1"
edition = "2021"
description = "The revolution will be televised."
license = "MIT"
authors = ["Alexandre Pasmantier <alex.pasmant@gmail.com>"]
repository = "https://github.com/alexpasmantier/television"
keywords = ["search", "fuzzy", "preview", "tui", "terminal"]
categories = [
"command-line-utilities",
"command-line-interface",
"concurrency",
"development-tools",
]
[dependencies]
nucleo = "0.5.0"
parking_lot = "0.12.3"

View File

@ -1,28 +0,0 @@
[package]
name = "television-previewers"
version = "0.0.1"
edition = "2021"
description = "The revolution will be televised."
license = "MIT"
authors = ["Alexandre Pasmantier <alex.pasmant@gmail.com>"]
repository = "https://github.com/alexpasmantier/television"
keywords = ["search", "fuzzy", "preview", "tui", "terminal"]
categories = [
"command-line-utilities",
"command-line-interface",
"concurrency",
"development-tools",
]
[dependencies]
syntect = "5.2.0"
television-channels = { version = "0.0.1", path = "../television_channels" }
television-utils = { version = "0.0.1", path = "../television_utils" }
tracing = "0.1.40"
parking_lot = "0.12.3"
tokio = "1.41.1"
termtree = "0.5.1"
devicons = "0.6.11"
color-eyre = "0.6.3"
infer = "0.16.0"

View File

@ -1,29 +0,0 @@
[package]
name = "television-utils"
version = "0.0.1"
edition = "2021"
description = "The revolution will be televised."
license = "MIT"
authors = ["Alexandre Pasmantier <alex.pasmant@gmail.com>"]
repository = "https://github.com/alexpasmantier/television"
keywords = ["search", "fuzzy", "preview", "tui", "terminal"]
categories = [
"command-line-utilities",
"command-line-interface",
"concurrency",
"development-tools",
]
[dependencies]
ignore = "0.4.23"
infer = "0.16.0"
lazy_static = "1.5.0"
tracing = "0.1.40"
color-eyre = "0.6.3"
bat = { version = "0.24.0", default-features = false, features = ["regex-onig"] }
directories = "5.0.1"
syntect = "5.2.0"
gag = "1.0.0"
[target.'cfg(windows)'.dependencies]
winapi-util = "0.1.9"