diff --git a/justfile b/justfile index 177ae8e3..8d00a935 100644 --- a/justfile +++ b/justfile @@ -70,8 +70,19 @@ test-docs toolchain="": && doc test-all toolchain="": (test toolchain) (test-docs toolchain) # Document crates in workspace. -doc *args: +doc *args: && doc-set-workspace-crates + rm -f "$(cargo metadata --format-version=1 | jq -r '.target_directory')/doc/crates.js" RUSTDOCFLAGS="--cfg=docsrs -Dwarnings" cargo +nightly doc --no-deps --workspace {{ all_crate_features }} {{ args }} + +[private] +doc-set-workspace-crates: + #!/usr/bin/env bash + ( + echo "window.ALL_CRATES =" + cargo metadata --format-version=1 \ + | jq '[.packages[] | select(.source == null) | .targets | map(select(.doc) | .name)] | flatten' + echo ";" + ) > "$(cargo metadata --format-version=1 | jq -r '.target_directory')/doc/crates.js" # Document crates in workspace and watch for changes. doc-watch: