Files
m038 5e954d8adf fix: update paths for trips/japan-korea-2026/dailies restructure
- Update post form parent, Makefile demo targets, and test scripts to use
  new trip-scoped paths (01.trips/japan-korea-2026/01.dailies)
- Rename tracker.spec.js → dailies.spec.js and update all /tracker URLs
  to /trips/japan-korea-2026/dailies across nav.spec.js, post.spec.js,
  helpers.js, and dailies.spec.js
- Add Italy 2025 demo trip to Makefile demo-load/demo-reset targets

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 01:49:38 +02:00

57 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Validates that post-form.md is wired correctly for the add-page-by-form plugin.
# Fast, no server needed. Catches the class of bug that caused silent post failures.
set -euo pipefail
FORM="user/pages/02.post/post-form.md"
PASS=0
FAIL=0
ERRORS=()
ok() { echo " ✓ $1"; PASS=$((PASS+1)); }
fail() { echo " ✗ $1"; FAIL=$((FAIL+1)); ERRORS+=("$1"); }
check_grep() {
local desc="$1"; local pattern="$2"
if grep -q "$pattern" "$FORM"; then ok "$desc"; else fail "$desc"; fi
}
echo ""
echo "Form config validator — $FORM"
echo "────────────────────────────────────────"
# Plugin trigger: must use add_page or addpage — NOT add-page-by-form
grep -q "add_page:\|addpage:" "$FORM" && ok "Process action is 'add_page' (plugin trigger)" \
|| fail "Process action must be 'add_page: true' — 'add-page-by-form' is not handled by the plugin"
# Config must be in frontmatter, not in the process block
check_grep "pageconfig block exists in frontmatter" "^pageconfig:"
check_grep "parent set to /trips/japan-korea-2026/dailies" "parent: '/trips/japan-korea-2026/dailies'"
check_grep "slug_field set (determines entry folder name)" "slug_field:"
check_grep "pagefrontmatter block exists in frontmatter" "^pagefrontmatter:"
check_grep "template: entry (creates entry.md filename)" "template: entry"
# Form name must stay 'new-entry' — cache-on-save plugin checks this exact string
check_grep "form name is 'new-entry' (required by cache-on-save plugin)" "name: new-entry"
# Required form fields
check_grep "title field present" "name: title"
check_grep "date field present" "name: date"
check_grep "content field present" "name: content"
check_grep "lat field present" "name: lat"
check_grep "lng field present" "name: lng"
check_grep "location_city field present" "name: location_city"
check_grep "location_country field present" "name: location_country"
echo "────────────────────────────────────────"
echo " $PASS passed, $FAIL failed"
if [ ${#ERRORS[@]} -gt 0 ]; then
echo ""
echo "Failed checks:"
for e in "${ERRORS[@]}"; do echo " → $e"; done
echo ""
exit 1
fi
echo ""