-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
149 lines (122 loc) · 4.41 KB
/
justfile
File metadata and controls
149 lines (122 loc) · 4.41 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
set working-directory := "."
dev-install:
cargo binstall cargo-watch -y
cargo binstall cargo-llvm-cov -y
cargo binstall cargo-insta -y
cargo binstall cargo-shear -y
cargo binstall cargo-diet -y
cargo binstall cargo-dist -y
cargo binstall release-plz -y
prettier_glob := "./**/*.{md,yaml,yml,ts,js}"
# format rust, justfile, and markdown
format:
cargo fmt --all
just --fmt --unstable
npx -y prettier {{ prettier_glob }} --write
format-check:
cargo fmt --all -- --check
just --fmt --unstable --check
npx -y prettier {{ prettier_glob }} --check
lint:
RUSTFLAGS=-Dwarnings cargo clippy --all-targets --all-features --workspace
pnpm --if-present lint
test_flags := "--all-features --workspace --all-targets"
test:
cargo test {{ test_flags }}
test-cov:
cargo llvm-cov {{ test_flags }}
test-cov-open:
cargo llvm-cov {{ test_flags }} --open
# deletes snapshots locally and rejects in CI
test-snapshot:
cargo insta test {{ test_flags }} --unreferenced auto
cargo insta review
xtask-command := "cargo run -p xtask -q --"
# generate markdown files from templates
readmes:
{{ xtask-command }} generate-readmes
# verify markdown files match generated templates
readmes-check:
{{ xtask-command }} verify-readmes
npm-markdown:
cp -f readme.md npm-template/README.md
cp -f CHANGELOG.md npm-template/CHANGELOG.md
# updates everything related to the package.json
package-json: npm-markdown
{{ xtask-command }} generate-npm-package
cd ./npm-template && npm i --ignore-scripts && npm shrinkwrap && git add npm-shrinkwrap.json
# regenerated npm package metadata and checks for changes
package-json-check: package-json
git diff --exit-code -- npm-template/npm-shrinkwrap.json
npm pack ./npm-template --dry-run
# install jjp into your path (watch)
install-watch:
cargo watch -q -c -x "install --path ."
# install jjp into your path
install:
cargo install --path .
vscode-bin-location := "./npm-packages/jjpwrgem-vscode/bin"
# build release binary and copy to the vscode extension bin dir
vscode-bin:
cargo build --release
mkdir -p {{ vscode-bin-location }}
if [ -f target/release/jjp ]; then \
cp target/release/jjp {{ vscode-bin-location }}/jjp; \
chmod +x {{ vscode-bin-location }}/jjp; \
elif [ -f target/release/jjp.exe ]; then \
cp target/release/jjp.exe {{ vscode-bin-location }}/jjp.exe; \
else \
echo "No built jjp binary found in target/release"; exit 1; \
fi
echo "Copied binary into {{ vscode-bin-location }}"
vscode-test-wsl: vscode-bin
# ensure XDG_RUNTIME_DIR is available and try to start a session DBus (if possible)
export XDG_RUNTIME_DIR="/tmp/runtime-$(id -u)"; \
mkdir -p "$XDG_RUNTIME_DIR"; chmod 700 "$XDG_RUNTIME_DIR"; \
if command -v dbus-launch >/dev/null 2>&1; then \
echo "Starting dbus-launch"; \
eval "$(dbus-launch --sh-syntax)" || true; \
elif command -v dbus-daemon >/dev/null 2>&1; then \
dbus-daemon --session --fork --print-address > "$XDG_RUNTIME_DIR/bus" 2>/dev/null || true; \
echo "Started dbus-daemon (if available)"; \
else \
echo "dbus not found; continuing without session bus"; \
fi; \
if command -v Xvfb >/dev/null 2>&1; then \
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & \
sleep 1; \
echo "Started Xvfb"; \
else \
echo "Xvfb not found; attempting to run tests without X server"; \
fi; \
export DISPLAY=":99.0"; \
pnpm --filter jjpwrgem-vscode test
# removes unnecessary files from crates before publishing
diet:
for x in ./crates/* .; do \
echo "dieting $x"; \
(cd $x && cargo diet -r); \
done
prepublish:
just format-check
just lint
just diet
release-binary:
release-plz update
cargo release --no-publish --tag-prefix=jjpwrgem- --execute
# preview release notes
release-notes:
dist host --steps=create --output-format=json | jq -r .announcement_github_body
# runs perf tests against 10+ cli tools and regenerates outputs and embeds in readmes
bench:
mkdir -p xtask/bench/output
docker build -t jjp-benchmark .
docker run --rm \
-u "$(id -u):$(id -g)" \
-v "$(pwd)/xtask/bench/output:/benchmark/output" \
jjp-benchmark
npx -y prettier './xtask/bench/output/*.md' --write
just plot-bench
just readmes
plot-bench:
cargo run -p xtask -- plot-benchmarks