mersinvald / aquamarine

Inline diagrams for rustdoc with mermaid.js
MIT License
487 stars 25 forks source link

Creates `target/doc` in the wrong directory #38

Closed dpc closed 1 year ago

dpc commented 1 year ago

When used in in a sub-crate of a larger workspace, when running cargo test a file is created:

./<sub-crate-dir>/target/doc/mermaid.min.js

instead of expected ./target/doc/mermaid.min.js for the whole workspace.

Seems to be caused by: https://github.com/mersinvald/aquamarine/blob/636675ba342a37a2a0aa87eb9adeea5c266f505c/src/attrs.rs#L140

Possibly CARGO_TARGET_DIR should be used instead as per https://doc.rust-lang.org/cargo/reference/environment-variables.html ?

frehberg commented 1 year ago

thanks for filing the issue. You are right "cargo test" should not generate the file target/doc/mermaid.min.js.

In fact the file should be created only and only if invoking "cargo doc"

No file should be created invoking "cargo test" as the tests do not require the JS package.

frehberg commented 1 year ago

Fixing this issue https://github.com/mersinvald/aquamarine/pull/36/commits

frehberg commented 1 year ago

has been fixed in newly released version 0.3.1 https://crates.io/crates/aquamarine/0.3.1

frehberg commented 1 year ago

as with release aquamarine 0.3.1 this issue has been solved