Fix the Probes page failing to load; add a JS syntax check
An apostrophe in "aren't" ended a single-quoted string in views/probes.js,
so the module failed to parse ("missing ) after argument list") and the
Probes page couldn't load. Use the typographic apostrophe like the rest of
the UI copy.
scripts/check-js.sh parses every frontend module as an ES module (node in a
container if the host has none). Plain node --check on a .js file accepted
the broken file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
cd2deda996
commit
cb092f2333
3 changed files with 21 additions and 1 deletions
19
scripts/check-js.sh
Executable file
19
scripts/check-js.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
# Syntax-check every frontend module as an ES module, the way browsers load them.
|
||||
# (A plain `node --check file.js` can miss errors: it may not parse the file as a module.)
|
||||
# Runs node in a container when the host has none. Exit 1 on the first broken file.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
check() {
|
||||
local tmp f fail=0
|
||||
tmp=$(mktemp -d)
|
||||
for f in $(find app/static/js -name '*.js' | sort); do
|
||||
cp "$f" "$tmp/check.mjs"
|
||||
if ! node --check "$tmp/check.mjs" 2>"$tmp/err"; then echo "SYNTAX ERROR in $f:"; sed -n '1,6p' "$tmp/err"; fail=1; fi
|
||||
done
|
||||
rm -rf "$tmp"
|
||||
[ "$fail" = 0 ] && echo "js: all modules parse"
|
||||
return "$fail"
|
||||
}
|
||||
if command -v node >/dev/null 2>&1; then check
|
||||
else docker run --rm -v "$PWD":/src:ro -w /src node:22-slim bash scripts/check-js.sh; fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue