Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:
jobs:
rust:
name: Rust
uses: RustForWeb/.github/.github/workflows/rust.yml@373c25f8fd29e10c40f1343f13312f8be3514af0
uses: RustForWeb/.github/.github/workflows/rust.yml@dc2442c27ef9f920a1a889ec94e615b419b491b2 # v1.0.1
with:
enable-test: false
target: wasm32-unknown-unknown
2 changes: 1 addition & 1 deletion .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ permissions:
jobs:
labels:
name: Labels
uses: RustForWeb/.github/.github/workflows/labels.yml@373c25f8fd29e10c40f1343f13312f8be3514af0
uses: RustForWeb/.github/.github/workflows/labels.yml@dc2442c27ef9f920a1a889ec94e615b419b491b2 # v1.0.1
6 changes: 5 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ on:
permissions:
contents: read
id-token: write
packages: write

jobs:
publish:
name: Publish
uses: RustForWeb/.github/.github/workflows/publish.yml@373c25f8fd29e10c40f1343f13312f8be3514af0
uses: RustForWeb/.github/.github/workflows/publish.yml@dc2442c27ef9f920a1a889ec94e615b419b491b2 # v1.0.1
with:
enable-rust: true
enable-typescript: false

target: wasm32-unknown-unknown
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ permissions:
jobs:
release:
name: Release
uses: RustForWeb/.github/.github/workflows/release.yml@373c25f8fd29e10c40f1343f13312f8be3514af0
uses: RustForWeb/.github/.github/workflows/release.yml@dc2442c27ef9f920a1a889ec94e615b419b491b2 # v1.0.1
with:
bump: ${{ inputs.bump }}
bump-rust: true
bump-typescript: false
extract-version: rust

target: wasm32-unknown-unknown
secrets:
app-client-id: ${{ secrets.APP_ID }}
app-private-key: ${{ secrets.APP_PRIVATE_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: cargo-bins/cargo-binstall@30b5ca8b54e1dcffd9548bc87ede1531310fdc67 # v1.20.0

- name: Install crates
run: cargo binstall --force -y dioxus-cli leptosfmt yew-fmt
run: cargo binstall --force -y dioxus-cli@0.7.9 leptosfmt@0.1.33 yew-fmt@0.6.3

- name: Check for upstream releases
run: cargo run -p scripts --bin upstream
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ concurrency:
jobs:
book:
name: Book
uses: RustForWeb/.github/.github/workflows/book.yml@373c25f8fd29e10c40f1343f13312f8be3514af0
uses: RustForWeb/.github/.github/workflows/book.yml@dc2442c27ef9f920a1a889ec94e615b419b491b2 # v1.0.1
2 changes: 0 additions & 2 deletions rust-toolchain.toml

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/src/frameworks/dioxus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use proc_macro2::TokenStream;
use quote::{ToTokens, quote};
use roxmltree::{Attribute, Children, Document, Node, NodeType};

use crate::framework::Framework;
use crate::{framework::Framework, status::ExitStatusExt};
pub struct Dioxus;

impl Framework for Dioxus {
Expand Down Expand Up @@ -162,15 +162,15 @@ impl Framework for Dioxus {
.arg("fmt")
.current_dir(path)
.status()?
.exit_ok()?;
.stable_exit_ok()?;

Command::new("cargo")
.arg("fmt")
.arg("-p")
.arg(&package)
.current_dir(repository_path)
.status()?
.exit_ok()?;
.stable_exit_ok()?;

Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions scripts/src/frameworks/leptos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use convert_case::{Case, Casing};
use proc_macro2::TokenStream;
use quote::{ToTokens, quote};

use crate::framework::Framework;
use crate::{framework::Framework, status::ExitStatusExt};

pub struct Leptos;

Expand Down Expand Up @@ -160,14 +160,14 @@ impl Framework for Leptos {
.arg(&package)
.current_dir(repository_path)
.status()?
.exit_ok()?;
.stable_exit_ok()?;

Command::new("leptosfmt")
.arg("--quiet")
.arg(path)
.current_dir(repository_path)
.status()?
.exit_ok()?;
.stable_exit_ok()?;

Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions scripts/src/frameworks/yew.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use convert_case::{Case, Casing};
use proc_macro2::TokenStream;
use quote::{ToTokens, quote};

use crate::framework::Framework;
use crate::{framework::Framework, status::ExitStatusExt};

pub struct Yew;

Expand Down Expand Up @@ -169,15 +169,15 @@ impl Framework for Yew {
.env("RUSTFMT", "yew-fmt")
.current_dir(repository_path)
.status()?
.exit_ok()?;
.stable_exit_ok()?;

Command::new("cargo")
.arg("fmt")
.arg("-p")
.arg(&package)
.current_dir(repository_path)
.status()?
.exit_ok()?;
.stable_exit_ok()?;

Ok(())
}
Expand Down
3 changes: 2 additions & 1 deletion scripts/src/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::{
frameworks::{dioxus::Dioxus, leptos::Leptos, yew::Yew},
metadata::Metadata,
repository::git_checkout,
status::ExitStatusExt,
};

pub fn generate(
Expand Down Expand Up @@ -152,7 +153,7 @@ fn generate_icon_names(path: &Path, names: &[String]) -> Result<(), Box<dyn Erro
.arg("lucide-icon-name")
.current_dir(path)
.status()?
.exit_ok()?;
.stable_exit_ok()?;

Ok(())
}
Expand Down
3 changes: 1 addition & 2 deletions scripts/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#![feature(exit_status_error)]

mod framework;
mod frameworks;
pub mod generate;
mod metadata;
pub mod repository;
mod status;

pub const GIT_URL: &str = "https://github.com/RustForWeb/lucide.git";
pub const GITHUB_OWNER: &str = "RustForWeb";
Expand Down
32 changes: 32 additions & 0 deletions scripts/src/status.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use std::{error::Error, fmt, num::NonZeroI32, process::ExitStatus};

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct ExitStatusError(Option<NonZeroI32>);

impl fmt::Display for ExitStatusError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some(code) = self.0 {
write!(f, "process exited unsuccessfully: {code}")
} else {
write!(f, "process exited unsuccessfully: unknown")
}
}
}

impl Error for ExitStatusError {}

pub trait ExitStatusExt {
fn stable_exit_ok(&self) -> Result<(), ExitStatusError>;
}

impl ExitStatusExt for ExitStatus {
fn stable_exit_ok(&self) -> Result<(), ExitStatusError> {
match self.code() {
Some(code) => match NonZeroI32::try_from(code) {
Ok(code) => Err(ExitStatusError(Some(code))),
Err(_) => Ok(()),
},
None => Err(ExitStatusError(None)),
}
}
}