Remove features due to crates.io limit of 300 features

See https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html for more information.
This commit is contained in:
Daniëlle Huisman 2024-11-24 19:59:50 +01:00
parent ed87d3decf
commit 9db3a4df9c
12 changed files with 8 additions and 12399 deletions

View file

@ -17,5 +17,4 @@ log.workspace = true
lucide-dioxus = { path = "../../packages/dioxus", optional = true } lucide-dioxus = { path = "../../packages/dioxus", optional = true }
[features] [features]
default = [] icons = ["dep:lucide-dioxus"]
icons = ["dep:lucide-dioxus", "lucide-dioxus/full"]

View file

@ -18,4 +18,4 @@ lucide-leptos = { path = "../../packages/leptos", optional = true }
[features] [features]
default = [] default = []
icons = ["dep:lucide-leptos", "lucide-leptos/full"] icons = ["dep:lucide-leptos"]

View file

@ -18,4 +18,4 @@ yew = { workspace = true, features = ["csr"] }
[features] [features]
default = [] default = []
icons = ["dep:lucide-yew", "lucide-yew/full"] icons = ["dep:lucide-yew"]

View file

@ -5,11 +5,7 @@ Implementation of the Lucide icon library for [Dioxus](https://dioxuslabs.com/)
## Installation ## Installation
```shell ```shell
# Selective Icons cargo add lucide-dioxus
cargo add lucide-dioxus --features camera,file-image,moon,sun
# All Icons
cargo add lucide-dioxus --features full
``` ```
- [View on crates.io](https://crates.io/crates/lucide-dioxus) - [View on crates.io](https://crates.io/crates/lucide-dioxus)

View file

@ -7,11 +7,7 @@ Implementation of the Lucide icon library for [Leptos](https://leptos.dev/) appl
Install the icons from your command line. Install the icons from your command line.
```shell ```shell
# Selective Icons cargo add lucide-leptos
cargo add lucide-leptos --features camera,file-image,moon,sun
# All Icons
cargo add lucide-leptos --features full
``` ```
- [View on crates.io](https://crates.io/crates/lucide-leptos) - [View on crates.io](https://crates.io/crates/lucide-leptos)

View file

@ -7,11 +7,7 @@ Implementation of the Lucide icon library for [Yew](https://yew.rs/) application
Install the icons from your command line. Install the icons from your command line.
```shell ```shell
# Selective Icons cargo add lucide-yew
cargo add lucide-yew --features camera,file-image,moon,sun
# All Icons
cargo add lucide-yew --features full
``` ```
- [View on crates.io](https://crates.io/crates/lucide-yew) - [View on crates.io](https://crates.io/crates/lucide-yew)

View file

@ -11,7 +11,3 @@ version.workspace = true
[dependencies] [dependencies]
dioxus.workspace = true dioxus.workspace = true
[features]
default = []
full = []

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -69,7 +69,6 @@ fn main() -> Result<(), Box<dyn Error>> {
for framework in &frameworks { for framework in &frameworks {
generate_lib(&**framework, &modules)?; generate_lib(&**framework, &modules)?;
generate_features(&**framework, &modules)?;
generate_example(&**framework, &component_names)?; generate_example(&**framework, &component_names)?;
framework.format( framework.format(
@ -148,25 +147,13 @@ fn generate_lib(framework: &dyn Framework, modules: &[String]) -> Result<(), Box
let output_modules = modules let output_modules = modules
.iter() .iter()
.map(|module| { .map(|module| format!("mod {};", sanitize_identifier(module.as_str())))
format!(
"#[cfg(feature = \"{}\")]\nmod {};",
module.trim_end_matches("_icon").to_case(Case::Kebab),
sanitize_identifier(module.as_str())
)
})
.collect::<Vec<String>>() .collect::<Vec<String>>()
.join("\n"); .join("\n");
let output_uses = modules let output_uses = modules
.iter() .iter()
.map(|module| { .map(|module| format!("pub use {}::*;", sanitize_identifier(module.as_str())))
format!(
"#[cfg(feature = \"{}\")]\npub use {}::*;",
module.trim_end_matches("_icon").to_case(Case::Kebab),
sanitize_identifier(module.as_str())
)
})
.collect::<Vec<String>>() .collect::<Vec<String>>()
.join("\n"); .join("\n");
@ -185,45 +172,6 @@ fn generate_lib(framework: &dyn Framework, modules: &[String]) -> Result<(), Box
Ok(()) Ok(())
} }
fn generate_features(framework: &dyn Framework, modules: &[String]) -> Result<(), Box<dyn Error>> {
let output_path = Path::new("packages")
.join(framework.name())
.join("features.toml");
let output_features = modules
.iter()
.map(|module| {
format!(
"{} = []",
module.trim_end_matches("_icon").to_case(Case::Kebab)
)
})
.collect::<Vec<String>>()
.join("\n");
let output_full = modules
.iter()
.map(|module| {
format!(
"\"{}\"",
module.trim_end_matches("_icon").to_case(Case::Kebab)
)
})
.collect::<Vec<String>>()
.join(", ");
let output = format!(
"[features]\ndefault = []\n{}\nfull = [{}]\n",
output_features, output_full
);
fs::write(output_path, output)?;
// TODO: Replace features in Cargo.toml instead of writing to features.toml.
Ok(())
}
fn sanitize_identifier(identifier: &str) -> &str { fn sanitize_identifier(identifier: &str) -> &str {
match identifier { match identifier {
"box" => "r#box", "box" => "r#box",