Skip to content

Commit

Permalink
docs: clarify hook installation requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
pplmx committed Sep 30, 2024
1 parent 0f6470f commit e5b8f86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@

4. Install hooks:

> **Note:** Due to the execution mechanism of `build.rs`, running `cargo clean` is required when installing or updating hooks.
```sh
cargo clean && cargo build
cargo clean && cargo test
```

---

**Tip:** If you add this library to the `[dependencies]` section, both `cargo build` and `cargo test` will work. However, if it's added under `[dev-dependencies]`, only `cargo test` will function as expected.

## Usage

### Supported Git Hooks
Expand Down
4 changes: 2 additions & 2 deletions tests/test_husky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn test_husky_rs_integration() -> std::io::Result<()> {
let cargo_toml_path = project_path.join("Cargo.toml");
let mut cargo_toml = fs::read_to_string(&cargo_toml_path)?;
cargo_toml.push_str(&format!(
"husky-rs = {{ path = {:?} }}\n",
"\n[dev-dependencies]\nhusky-rs = {{ path = {:?} }}\n",
relative_crate_path
));
fs::write(&cargo_toml_path, cargo_toml)?;
Expand All @@ -87,7 +87,7 @@ echo "This is a test hook"

// Run cargo build
Command::new("cargo")
.arg("build")
.arg("test")
.current_dir(project_path)
.status()?;

Expand Down

0 comments on commit e5b8f86

Please sign in to comment.