Skip to content

Commit 71aa90d

Browse files
authored
Add tlsn-wasm to API docs (#768)
1 parent 93535ca commit 71aa90d

File tree

2 files changed

+37
-7
lines changed

2 files changed

+37
-7
lines changed

.github/workflows/rustdoc.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,13 @@ jobs:
2121
toolchain: stable
2222

2323
- name: "rustdoc"
24-
run: cargo doc -p tlsn-core -p tlsn-prover -p tlsn-verifier --no-deps --all-features
25-
# --target-dir ${GITHUB_WORKSPACE}/docs
24+
run: crates/wasm/build-docs.sh
2625

27-
# https://dev.to/deciduously/prepare-your-rust-api-docs-for-github-pages-2n5i
28-
- name: "Add index file -> tlsn_prover"
29-
run: |
30-
echo "<meta http-equiv=\"refresh\" content=\"0; url=tlsn_prover\">" > target/doc/index.html
3126

3227
- name: Deploy
3328
uses: peaceiris/actions-gh-pages@v3
3429
if: ${{ github.ref == 'refs/heads/dev' }}
3530
with:
3631
github_token: ${{ secrets.GITHUB_TOKEN }}
37-
publish_dir: target/doc/
32+
publish_dir: target/wasm32-unknown-unknown/doc/
3833
# cname: rustdocs.tlsnotary.org

crates/wasm/build-docs.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
cd "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
6+
# List the packages you want to document
7+
PACKAGES=("tlsn-core" "tlsn-prover" "tlsn-verifier" "tlsn-wasm")
8+
9+
# Find all features, except for the "test" features
10+
FEATURES=$(
11+
cargo metadata --no-deps --format-version=1 |
12+
jq -r --argjson names "$(printf '%s\n' "${PACKAGES[@]}" | jq -R . | jq -s .)" '
13+
.packages[]
14+
| select(.name as $n | $names | index($n))
15+
| .features
16+
| keys[]
17+
| select(. != "test" and . != "rstest")
18+
' | sort -u | paste -sd, -
19+
)
20+
21+
# Join package names for the `-p` args
22+
PACKAGE_ARGS=()
23+
for pkg in "${PACKAGES[@]}"; do
24+
PACKAGE_ARGS+=("-p" "$pkg")
25+
done
26+
27+
# Build docs using the correct config and filtered features
28+
cargo +nightly doc \
29+
"${PACKAGE_ARGS[@]}" \
30+
--no-deps \
31+
--features "$FEATURES"
32+
33+
# https://dev.to/deciduously/prepare-your-rust-api-docs-for-github-pages-2n5i
34+
echo "Add index file -> tlsn_prover"
35+
echo "<meta http-equiv=\"refresh\" content=\"0; url=tlsn_prover\">" >../../target/wasm32-unknown-unknown/doc/index.html

0 commit comments

Comments
 (0)