Skip to content

Commit

Permalink
refactor(workspace): reorganize cargo workspace (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpasmantier authored Nov 11, 2024
1 parent 7bc6f29 commit 5611ee8
Show file tree
Hide file tree
Showing 47 changed files with 182 additions and 205 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 {
Expand Down
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 41 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
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",
Expand All @@ -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",
Expand Down Expand Up @@ -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 <[email protected]>"]
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"
Expand All @@ -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"] }
30 changes: 30 additions & 0 deletions crates/television-channels/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"] }

File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions crates/television-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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};
///
Expand Down
18 changes: 18 additions & 0 deletions crates/television-fuzzy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
///
Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions crates/television-previewers/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"

File renamed without changes.
28 changes: 28 additions & 0 deletions crates/television-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions crates/television/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down
30 changes: 0 additions & 30 deletions crates/television_channels/Cargo.toml

This file was deleted.

Loading

0 comments on commit 5611ee8

Please sign in to comment.