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 }
[features]
default = []
icons = ["dep:lucide-dioxus", "lucide-dioxus/full"]
icons = ["dep:lucide-dioxus"]

View file

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

View file

@ -18,4 +18,4 @@ yew = { workspace = true, features = ["csr"] }
[features]
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
```shell
# Selective Icons
cargo add lucide-dioxus --features camera,file-image,moon,sun
# All Icons
cargo add lucide-dioxus --features full
cargo add 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.
```shell
# Selective Icons
cargo add lucide-leptos --features camera,file-image,moon,sun
# All Icons
cargo add lucide-leptos --features full
cargo add 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.
```shell
# Selective Icons
cargo add lucide-yew --features camera,file-image,moon,sun
# All Icons
cargo add lucide-yew --features full
cargo add lucide-yew
```
- [View on crates.io](https://crates.io/crates/lucide-yew)

View file

@ -11,7 +11,3 @@ version.workspace = true
[dependencies]
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 {
generate_lib(&**framework, &modules)?;
generate_features(&**framework, &modules)?;
generate_example(&**framework, &component_names)?;
framework.format(
@ -148,25 +147,13 @@ fn generate_lib(framework: &dyn Framework, modules: &[String]) -> Result<(), Box
let output_modules = modules
.iter()
.map(|module| {
format!(
"#[cfg(feature = \"{}\")]\nmod {};",
module.trim_end_matches("_icon").to_case(Case::Kebab),
sanitize_identifier(module.as_str())
)
})
.map(|module| format!("mod {};", sanitize_identifier(module.as_str())))
.collect::<Vec<String>>()
.join("\n");
let output_uses = modules
.iter()
.map(|module| {
format!(
"#[cfg(feature = \"{}\")]\npub use {}::*;",
module.trim_end_matches("_icon").to_case(Case::Kebab),
sanitize_identifier(module.as_str())
)
})
.map(|module| format!("pub use {}::*;", sanitize_identifier(module.as_str())))
.collect::<Vec<String>>()
.join("\n");
@ -185,45 +172,6 @@ fn generate_lib(framework: &dyn Framework, modules: &[String]) -> Result<(), Box
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 {
match identifier {
"box" => "r#box",