-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
58 lines (50 loc) · 2.74 KB
/
Copy pathjustfile
File metadata and controls
58 lines (50 loc) · 2.74 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
# chrome-core — task runner
# Recipes run in `sh`, which doesn't inherit cargo from an interactive fish/zsh setup.
export PATH := env_var('HOME') + "/.cargo/bin:" + env_var('PATH')
# `default` pipes `just --list` through a small stock-perl filter that clips long recipe
# docs to your terminal width (…) instead of wrapping. Self-contained — no external files;
# falls back to plain `just --list` where perl is absent. Edit the recipes below, not this.
# List available recipes
default:
@if command -v perl >/dev/null 2>&1; then just --color always --list | perl -CS -Mutf8 -lpe 'BEGIN{($w)=`stty size 2>/dev/null </dev/tty`=~/ (\d+)/; $w||=100; $col=(-t STDOUT && !exists $ENV{NO_COLOR})} s/\e\[[0-9;]*m//g unless $col; (my $v=$_)=~s/\e\[[0-9;]*m//g; if(length($v)>$w){my($o,$n)=("",0); while(length && $n<$w-1){ if($col && s/^(\e\[[0-9;]*m)//){$o.=$1}else{s/^(.)//;$o.=$1;$n++} } $_=$o."…".($col?"\e[0m":"")}'; else just --list; fi
# The fast loop for iterating on assets/sidebar.{css,js} without building curator or warden.
# URL params: ?density=compact and ?header=1 (mount a header-slot stand-in); see preview.html.
# Open the visual preview (the sidebar mounted in isolation) in your default browser.
[group("dev")]
preview:
open "{{justfile_directory()}}/preview.html"
# Headless-screenshot the preview to preview.png (git-ignored). Density: `just shot compact`.
[group("dev")]
shot density="comfortable":
#!/usr/bin/env bash
set -euo pipefail
dir="{{justfile_directory()}}"
browser=""
for b in chromium google-chrome google-chrome-stable "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"; do
if command -v "$b" >/dev/null 2>&1 || [ -x "$b" ]; then browser="$b"; break; fi
done
[ -n "$browser" ] || { echo "✗ no Chromium/Chrome found — install one or just \`just preview\`"; exit 1; }
"$browser" --headless=new --disable-gpu --hide-scrollbars --force-device-scale-factor=2 \
--window-size=310,900 --default-background-color=00000000 \
--screenshot="$dir/preview.png" "file://$dir/preview.html?density={{density}}"
echo "✓ wrote preview.png ({{density}})"
# Covers: tileInitial, tileColour, tintOverBase, clampWidth, presenceClass, derivePresenceState,
# resolveOffset, buildTree. DOM/visual behaviour is out of scope — use `just preview` / `just shot`.
# Unit-test the component's pure JS logic (zero deps, node:test)
[group("check")]
test:
node --test
# Compile the include_str! constants (catches a missing/renamed asset)
[group("check")]
build:
cargo build
# Format Rust sources
[group("check")]
fmt:
cargo fmt
# Pre-merge gate: rustfmt check (non-mutating), JS unit tests, and the include_str! build.
[group("check")]
gate:
cargo fmt --check
node --test
cargo build