Skip to content

Commit 05e09db

Browse files
committed
minify json when building
1 parent e5a594e commit 05e09db

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

.github/workflows/pages.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ jobs:
3535
- uses: DeterminateSystems/magic-nix-cache-action@main
3636

3737
- name: install tools
38-
run: nix profile add "nixpkgs#just" && just -V
38+
run: |
39+
nix profile add "nixpkgs#just" && just -V
40+
nix profile add "nixpkgs#fd" && fd -V
41+
nix profile add "nixpkgs#jq" && jq -V
3942
4043
- uses: actions/setup-node@v4
4144
with:

.justfile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ spoilers-font-file := "frontend/public/SpoilersAhead.otf"
99
dev: download-spoilers-font (yarn "dev --host --port 8080")
1010

1111
# build frontend
12-
build: download-spoilers-font (yarn-prod "build")
12+
build: download-spoilers-font minify-json (yarn-prod "build")
1313

1414
# run frontend in prod mode
1515
preview: download-spoilers-font (yarn-prod "preview")
@@ -30,6 +30,24 @@ download-spoilers-font:
3030
wget "{{ spoilers-font }}" -O "{{ spoilers-font-file }}"; \
3131
fi
3232

33+
minify-json:
34+
#!/usr/bin/env bash
35+
if [[ "$CI" == "" ]]; then
36+
echo ignoring minifying in non-ci
37+
exit
38+
fi
39+
40+
set -euo pipefail
41+
42+
cd frontend
43+
for p in $(fd .json public); do
44+
echo minifying $p
45+
46+
tmp="$(mktemp)"
47+
jq -c . "$p" > "$tmp"
48+
mv "$tmp" "$p"
49+
done
50+
3351
# extract game translations
3452
extract-translations:
3553
cargo r --release --package tr-extractor -- --write -vv --output-dir=frontend/public

0 commit comments

Comments
 (0)