-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathjustfile
137 lines (106 loc) · 3.17 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# THIS FILE IS AUTOGENERATED FROM FLAKEBOX CONFIGURATION
import "justfile.fmo.just"
alias b := build
alias c := check
alias t := test
[private]
default:
@just --list
# run `cargo build` on everything
build_package PACKAGE *ARGS:
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
cargo build -p {{PACKAGE}} {{ARGS}}
build *ARGS:
just build_package fmo_server {{ARGS}}
just build_package fmo_frontend --target wasm32-unknown-unknown {{ARGS}}
# run `cargo check` on everything
check_package PACKAGE *ARGS:
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
cargo check -p {{PACKAGE}} {{ARGS}}
check *ARGS:
just check_package fmo_server {{ARGS}}
just check_package fmo_frontend --target wasm32-unknown-unknown {{ARGS}}
# run all checks recommended before opening a PR
final-check: lint clippy
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
cargo test --doc
just test
# run code formatters
format:
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
cargo fmt --all
nixpkgs-fmt $(echo **.nix)
# run lints (git pre-commit hook)
lint:
#!/usr/bin/env bash
set -euo pipefail
env NO_STASH=true $(git rev-parse --git-common-dir)/hooks/pre-commit
# run tests
test_package PACKAGE:
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
cargo test -p {{PACKAGE}}
test:
just test_package fmo_server
just test_package fmo_frontend --target wasm32-unknown-unknown
# run and restart on changes
watch *ARGS="-x run":
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
env RUST_LOG=${RUST_LOG:-debug} cargo watch {{ARGS}}
# run `cargo clippy` on everything
clippy_package PACKAGE *ARGS="--locked":
cargo clippy -p {{PACKAGE}} {{ARGS}}
clippy *ARGS="--locked":
just clippy_package fmo_server {{ARGS}}
just clippy_package fmo_frontend --target wasm32-unknown-unknown {{ARGS}}
# run `cargo clippy --fix` on everything
clippy_fix-package PACKAGE *ARGS="--locked --offline":
cargo clippy -p {{PACKAGE}} {{ARGS}} --fix
clippy-fix *ARGS="--locked --offline":
just clippy_fix-package fmo_server {{ARGS}}
just clippy_fix-package fmo_frontend --target wasm32-unknown-unknown {{ARGS}}
# run `semgrep`
semgrep:
env SEMGREP_ENABLE_VERSION_CHECK=0 \
semgrep --error --no-rewrite-rule-ids --config .config/semgrep.yaml
# check typos
[no-exit-message]
typos *PARAMS:
#!/usr/bin/env bash
set -eo pipefail
export FLAKEBOX_GIT_LS
FLAKEBOX_GIT_LS="$(git ls-files)"
export FLAKEBOX_GIT_LS_TEXT
FLAKEBOX_GIT_LS_TEXT="$(echo "$FLAKEBOX_GIT_LS" | grep -v -E "^db/|\.(png|ods|jpg|jpeg|woff2|keystore|wasm|ttf|jar|ico)\$")"
if ! echo "$FLAKEBOX_GIT_LS_TEXT" | typos {{PARAMS}} --file-list - --force-exclude ; then
>&2 echo "Typos found: Valid new words can be added to '.typos.toml'"
return 1
fi
# fix all typos
[no-exit-message]
typos-fix-all:
just typos -w
# THIS FILE IS AUTOGENERATED FROM FLAKEBOX CONFIGURATION