Add thymeleaf-htmx module: Spring Boot 4.1.2 + Thymeleaf 3.1.5 + htmx 2.0.11 CRUD UI with fragment rendering, 422 validation re-render, pagination, inline edit, delete, MockMvc tests and a Chromium check

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b7rnC7jppGGdHGESvy
This commit is contained in:
Claude
2026-10-28 18:23:46 +00:00
parent 93c709c34d
commit 99a8a0df42
37 changed files with 1840 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Needs Node 20+ and a one-time `npx playwright install chromium`. Starts a FRESH jar (data is mutated).
set -euo pipefail
cd "$(dirname "$0")/.."
PORT=${PORT:-18083}
java -Xmx256m -jar target/thymeleaf-htmx-1.0.0.jar --server.port=$PORT > /tmp/thymeleaf-htmx-browser.log 2>&1 &
PID=$!
trap 'kill $PID 2>/dev/null || true' EXIT
for i in $(seq 1 60); do curl -s -o /dev/null localhost:$PORT/contacts && break; sleep 1; done
(cd browser-check && npm install --silent && node check.mjs http://localhost:$PORT)
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Boots the packaged jar on a private port and shows the same URL answering twice.
set -euo pipefail
cd "$(dirname "$0")/.."
PORT=${PORT:-18082}
java -Xmx256m -jar target/thymeleaf-htmx-1.0.0.jar --server.port=$PORT > /tmp/thymeleaf-htmx-live.log 2>&1 &
PID=$!
trap 'kill $PID 2>/dev/null || true' EXIT
for i in $(seq 1 60); do curl -s -o /dev/null localhost:$PORT/contacts && break; sleep 1; done
B=http://localhost:$PORT
echo "\$ curl -si $B/contacts | tr -d '\r' | grep -v -E '^(Date|Transfer-Encoding)' | head -10"
curl -si $B/contacts | tr -d '\r' | grep -v -E '^(Date|Transfer-Encoding)' | head -10
echo
echo "\$ curl -si -H 'HX-Request: true' $B/contacts | tr -d '\r' | grep -v -E '^(Date|Transfer-Encoding)' | head -8"
curl -si -H 'HX-Request: true' $B/contacts | tr -d '\r' | grep -v -E '^(Date|Transfer-Encoding)' | head -8
echo
echo "\$ curl -s -o /dev/null -w '%{http_code} %{content_type}\n' $B/webjars/htmx.org/dist/htmx.min.js"
curl -s -o /dev/null -w '%{http_code} %{content_type}\n' $B/webjars/htmx.org/dist/htmx.min.js
echo
echo "\$ curl -si -X DELETE -H 'HX-Request: true' $B/contacts/23"
curl -si -X DELETE -H 'HX-Request: true' $B/contacts/23 | tr -d '\r' | grep -v '^Date'
echo
echo "\$ curl -si -X DELETE -H 'HX-Request: true' $B/contacts/23 (again)"
curl -si -X DELETE -H 'HX-Request: true' $B/contacts/23 | head -1
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Regenerates every file in output/ : the test suite writes the MockMvc transcripts,
# then a real Tomcat is started and driven with curl for 10-live-*.txt.
set -euo pipefail
cd "$(dirname "$0")/.."
rm -rf output && mkdir -p output
mvn -B -q test > /tmp/thymeleaf-htmx-mvn.log 2>&1 || { cat /tmp/thymeleaf-htmx-mvn.log; exit 1; }
mvn -B -q -DskipTests package > /dev/null 2>&1
./scripts/live-demo.sh > output/10-live-curl.txt
grep -E 'Tests run' target/surefire-reports/*.txt | sed 's#.*/##' > output/00-mvn-test.txt
if [ -d browser-check/node_modules ] || command -v node >/dev/null; then ./scripts/browser-check.sh > output/11-browser-check.txt; fi
ls output