# Tapir handbook — an mdBook guide (https://rust-lang.github.io/mdBook).
# Themed to the website palette via theme/tapir.css. Output -> dist/.
#
#   just book serve   # live-reload dev server on 0.0.0.0:3000 (reachable over SSH)
#   just book build   # render the book into dist/
#   just book test    # compile the code samples in the pages
#   just book clean    # remove the rendered book

set shell := ["bash", "-uc"]

# Default: list recipes.
default:
    @just --list --unsorted

# Render the book into dist/.
build:
    mdbook build

# Live-reload dev server (Ctrl-C to stop). Binds all interfaces so it's
# reachable over SSH/LAN at http://<host-ip>:3000; live reload still works
# (the page derives the websocket host from the URL you opened). Pin it down
# with e.g. `just book serve 127.0.0.1 8080`.
serve host="0.0.0.0" port="3000":
    mdbook serve --hostname {{host}} --port {{port}}

# Compile the Rust code samples embedded in the pages.
test:
    mdbook test

# Remove the rendered book.
clean:
    rm -rf dist
