diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 931d31a..58c6683 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -63,6 +63,17 @@ jobs: cargo run working-directory: ./example_shadow_hook + # example_wasm check + - name: Setup wasm-pack + uses: jetli/wasm-pack-action@v0.4.0 + with: + version: latest + run: | + cargo b + wasm-pack build --target bundler + wasm-pack build --target web + working-directory: ./example_wasm + # build on nightly - uses: actions-rs/toolchain@v1 with: diff --git a/Cargo.toml b/Cargo.toml index a9807d5..229c421 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ license = "MIT AND Apache-2.0" exclude = ["shadow-rs.png", "build_module.png"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [package.metadata.docs.rs] all-features = true @@ -40,4 +39,4 @@ default = ["git2", "tzdb"] regex = "1.7.0" [workspace] -members = ["example_shadow", "example_shadow_hook"] +members = ["example_shadow", "example_shadow_hook", "example_wasm"] diff --git a/example_wasm/Cargo.toml b/example_wasm/Cargo.toml new file mode 100644 index 0000000..e434dbc --- /dev/null +++ b/example_wasm/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "example_wasm" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +crate-type = ["cdylib", "rlib"] + + +[dependencies] +shadow-rs = { path = "../", default-features = false, features = ["tzdb"] } \ No newline at end of file diff --git a/example_wasm/src/lib.rs b/example_wasm/src/lib.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/example_wasm/src/lib.rs @@ -0,0 +1 @@ + diff --git a/src/git.rs b/src/git.rs index b89c2cb..a024c30 100644 --- a/src/git.rs +++ b/src/git.rs @@ -1,8 +1,6 @@ use crate::build::{ConstType, ConstVal, ShadowConst}; use crate::ci::CiType; -use crate::date_time::DateTime; use crate::err::*; -use crate::Format; use std::collections::BTreeMap; use std::io::{BufReader, Read}; use std::path::Path; @@ -135,10 +133,13 @@ impl Git { Ok(()) } + #[allow(unused_variables)] fn init_git2(&mut self, path: &Path) -> SdResult<()> { #[cfg(feature = "git2")] { + use crate::date_time::DateTime; use crate::git::git2_mod::git_repo; + use crate::Format; let repo = git_repo(path).map_err(ShadowError::new)?; let reference = repo.head().map_err(ShadowError::new)?;