28 lines
1.6 KiB
Bash
Executable File
28 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Builds the diff-viewer's frames: each ui/<frame>.html is one self-contained
|
|
# document (a plugin frame has no network) = frames.css + the shared renderer
|
|
# (ui/src/diff-render.js, also inlined by the commits plugin) + common.js +
|
|
# the frame's own script. Re-run after editing ui/src/ — never edit ui/*.html.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
frame() { # frame <out> <html class> <app class> <script> <comment>
|
|
local out="$1" hcls="$2" acls="$3" js="$4" what="$5"
|
|
{
|
|
printf '<!doctype html>\n<html%s><head><meta charset="utf-8" />\n' "${hcls:+ class=\"$hcls\"}"
|
|
printf '<meta name="viewport" content="width=device-width, initial-scale=1" />\n'
|
|
printf '<!-- %s\n Generated by build.sh from ui/src/ — edit those, not this. -->\n' "$what"
|
|
printf '<style>\n'; cat ui/src/frames.css; printf '</style>\n</head><body>\n'
|
|
printf '<div id="app"%s></div>\n' "${acls:+ class=\"$acls\"}"
|
|
printf '<script>\n'; cat ui/src/diff-render.js
|
|
printf '\n</script>\n<script>\n'; cat ui/src/common.js
|
|
printf '\n</script>\n<script>\n'; cat "ui/src/$js"
|
|
printf '\n</script>\n</body></html>\n'
|
|
} > "ui/$out"
|
|
echo "ui/$out: $(wc -c < "ui/$out") bytes"
|
|
}
|
|
|
|
frame changes.html dv-fill dv-tab changes.js "conversation.tab \"changes\": the conversation's commits and uncommitted work, reviewable."
|
|
frame uncommitted.html "" dv-slot uncommitted.js "conversation.details \"uncommitted\": the uncommitted-changes row."
|
|
frame diff.html dv-fill dv-pagebox page.js "page \"diff\": a repo commit (?repo=&sha=) or a conversation's net diff (?id=)."
|