Skip to content

Commit

Permalink
Add install script, only write auto ID output on change
Browse files Browse the repository at this point in the history
  • Loading branch information
willcrichton committed Sep 20, 2023
1 parent 6ad391a commit ec51957
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ script = """
cargo clean
cd js && depot clean && cd ..
rm -rf js/packages/quiz/src/bindings crates/mdbook-quiz-schema/bindings
"""

[tasks.install]
dependencies = ["init-bindings"]
script = """
cargo install --path crates/mdbook-quiz --features rust-editor --features aquascope --locked
"""
4 changes: 3 additions & 1 deletion crates/mdbook-quiz/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ impl QuizPreprocessor {
q.insert("id", Item::Value(Value::String(Formatted::new(id))));
}
}
fs::write(path, doc.to_string())?;
if changed {
fs::write(path, doc.to_string())?;
}
Ok(changed)
}

Expand Down

0 comments on commit ec51957

Please sign in to comment.