-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjustfile
67 lines (54 loc) · 1.78 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env -S just --justfile
# ^ A shebang isn't required, but allows a justfile to be executed
# like a script, with `./justfile test`, for example.
clone-dir := "./tmp/api"
proto-dest-dir := "./proto"
# Show available commands
default:
@just --list --justfile {{justfile()}}
# Update the protobuf files
update: clone copy-buf-files export
# Clone the api repo
clone:
rm -rf {{ clone-dir }}
git clone https://github.com/openfga/api.git {{ clone-dir }}
# Copy the dependencies from the cloned repo to the root directory
copy-buf-files:
rm -f ./buf.gen.yaml
rm -f ./buf.yaml
cp {{ clone-dir }}/buf.gen.yaml ./buf.gen.yaml
cp {{ clone-dir }}/buf.yaml ./buf.yaml
[private]
export:
mkdir -p {{ proto-dest-dir }}
buf export {{ clone-dir }} --output {{ proto-dest-dir }}
# Run cargo doc
doc $RUSTDOCFLAGS="-D warnings":
cargo doc --all --no-deps
# Run cargo doc on all crates and open the docs in your browser
doc-open $RUSTDOCFLAGS="-A missing_docs":
cargo doc --all --no-deps --open
# Substitute BIN for your bin directory.
# Substitute VERSION for the current released version.
install-buf:
#!/usr/bin/env sh
BIN="/usr/local/bin" && \
VERSION="1.30.1" && \
curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m)" \
-o "${BIN}/buf" && \
chmod +x "${BIN}/buf"
[private]
fmt:
cargo +nightly fmt --all
# Show unused dependencies
udeps:
cargo +nightly udeps
# Run various auditing tools to assure we are legal and safe
audit:
cargo deny check advisories bans licenses sources
# Run cargo clippy on all crates, fixing what can be fixed, and format all code
clippy-fix:
cargo clippy --fix --all --tests --examples
cargo clippy --fix --allow-dirty --all
cargo fmt --all