Fix demo site auto-enhancement and content persistence

- Restructure demo directory from test-sites/ to demos/ with flattened layout
- Add auto-enhancement on server startup for all sites with auto_enhance: true
- Fix inconsistent content ID generation that prevented dan-eden-portfolio content persistence
- Update server configuration to enhance from source to separate output directories
- Remove manual enhancement from justfile in favor of automatic server enhancement
- Clean up legacy test files and unused restore command
- Update build system to use CDN endpoint instead of file copying
This commit is contained in:
2025-09-17 00:07:40 +02:00
parent 1fa607c47c
commit 71561316da
73 changed files with 190 additions and 4827 deletions

View File

@@ -17,12 +17,7 @@ dev: build-lib build
echo "================================================"
echo ""
# Enhance demo site if needed
if [ ! -d "./test-sites/demo-site_enhanced" ]; then
echo "🔧 Demo site not ready - enhancing now..."
./insertr enhance test-sites/demo-site --output test-sites/demo-site_enhanced --config test-sites/demo-site/insertr.yaml
echo "✅ Demo site enhanced!"
fi
# Note: Sites are auto-enhanced by the server on startup
echo ""
echo "🔌 Starting Insertr server with all sites..."
@@ -45,9 +40,9 @@ dev: build-lib build
echo ""
echo "🌐 All sites available at:"
echo " Demo site: http://localhost:8080/sites/demo/"
echo " Default site: http://localhost:8080/sites/default/"
echo " Simple site: http://localhost:8080/sites/simple/"
echo " Dan Eden site: http://localhost:8080/sites/dan-eden/"
echo " Dan Eden site: http://localhost:8080/sites/dan-eden-portfolio/"
echo ""
echo "📝 Full-stack ready - edit content with real-time persistence!"
echo "🔄 Press Ctrl+C to shutdown"
@@ -60,7 +55,7 @@ dev: build-lib build
dev-about: build-lib build
#!/usr/bin/env bash
echo "🚀 Starting full-stack development..."
echo "🌐 About page available at: http://localhost:8080/sites/demo/about.html"
echo "🌐 About page available at: http://localhost:8080/sites/default/about.html"
INSERTR_DATABASE_PATH=./insertr.db ./insertr serve --dev-mode
# Check project status and validate setup
@@ -70,9 +65,9 @@ check:
# Simple demo launcher - all sites now served from main server
demo:
@echo "🌐 All demo sites are served from the main server:"
@echo " http://localhost:8080/sites/demo/ - Main demo site"
@echo " http://localhost:8080/sites/default/ - Main demo site"
@echo " http://localhost:8080/sites/simple/ - Simple test site"
@echo " http://localhost:8080/sites/dan-eden/ - Dan Eden portfolio"
@echo " http://localhost:8080/sites/dan-eden-portfolio/ - Dan Eden portfolio"
@echo ""
@echo "🚀 To start the development server:"
@echo " just dev"
@@ -104,7 +99,7 @@ help:
# Enhance demo site (build-time content injection)
enhance input="test-sites/demo-site" output="dist":
enhance input="demos/default" output="dist":
./insertr enhance {{input}} --output {{output}} --mock
# === Content API Server Commands ===
@@ -124,7 +119,7 @@ health port="8080":
@echo "🔍 Checking API server health..."
@curl -s http://localhost:{{port}}/health | jq . || echo "❌ Server not responding at localhost:{{port}}"
# Clean all build artifacts and backups
# Clean all build artifacts
clean:
rm -rf lib/dist
rm -rf insertr
@@ -134,7 +129,7 @@ clean:
rm -rf lib/node_modules
rm -f dev.db
rm -f insertr.db
@echo "🧹 Cleaned all build artifacts and backups"
@echo "🧹 Cleaned all build artifacts"
@@ -163,7 +158,7 @@ status:
@echo "\n🔧 Unified binary:"
@ls -la insertr main.go cmd/ internal/ 2>/dev/null || echo " Missing unified binary components"
@echo "\n🌐 Demo site:"
@ls -la test-sites/demo-site/index.html test-sites/demo-site/about.html 2>/dev/null || echo " Missing demo files"
@ls -la demos/demo-site/index.html demos/demo-site/about.html 2>/dev/null || echo " Missing demo files"
@echo ""
@echo "🚀 Development Commands:"
@echo " just dev - Full-stack development (recommended)"
@@ -191,53 +186,44 @@ clean-demos:
echo "========================================="
# Demo directories
if [ -d "./test-sites/demo-site_enhanced" ]; then
rm -rf "./test-sites/demo-site_enhanced"
echo "🗑️ Removed: demo-site_enhanced"
if [ -d "./demos/default_enhanced" ]; then
rm -rf "./demos/default_enhanced"
echo "🗑️ Removed: default_enhanced"
fi
if [ -d "./test-sites/simple/dan-eden-portfolio_enhanced" ]; then
rm -rf "./test-sites/simple/dan-eden-portfolio_enhanced"
if [ -d "./demos/simple_enhanced" ]; then
rm -rf "./demos/simple_enhanced"
echo "🗑️ Removed: simple_enhanced"
fi
if [ -d "./demos/dan-eden-portfolio_enhanced" ]; then
rm -rf "./demos/dan-eden-portfolio_enhanced"
echo "🗑️ Removed: dan-eden-portfolio_enhanced"
fi
if [ -d "./test-sites/simple/test-simple_enhanced" ]; then
rm -rf "./test-sites/simple/test-simple_enhanced"
echo "🗑️ Removed: test-simple_enhanced"
fi
# Clean up any temporary directories
if [ -d "./test-sites/simple/dan-eden-portfolio-temp" ]; then
rm -rf "./test-sites/simple/dan-eden-portfolio-temp"
if [ -d "./demos/dan-eden-portfolio-temp" ]; then
rm -rf "./demos/dan-eden-portfolio-temp"
echo "🗑️ Removed: dan-eden-portfolio-temp"
fi
if [ -d "./test-sites/simple/test-simple-temp" ]; then
rm -rf "./test-sites/simple/test-simple-temp"
echo "🗑️ Removed: test-simple-temp"
if [ -d "./demos/simple-temp" ]; then
rm -rf "./demos/simple-temp"
echo "🗑️ Removed: simple-temp"
fi
# Legacy directories (cleanup from old workflow)
for legacy_dir in dan-eden-portfolio-auto-enhanced dan-eden-portfolio-full dan-eden-portfolio-auto dan-eden-portfolio-auto-v2 dan-eden-portfolio-auto-enhanced test-simple-auto-enhanced test-simple-full dan-eden-portfolio-enhanced test-simple-enhanced; do
if [ -d "./test-sites/simple/${legacy_dir}" ]; then
rm -rf "./test-sites/simple/${legacy_dir}"
for legacy_dir in demo-site demo-site_enhanced demo_enhanced simple/test-simple simple/dan-eden-portfolio; do
if [ -d "./demos/${legacy_dir}" ]; then
rm -rf "./demos/${legacy_dir}"
echo "🗑️ Removed: ${legacy_dir} (legacy)"
fi
done
if [ -d "./test-sites/simple/dan-eden-portfolio-full" ]; then
rm -rf "./test-sites/simple/dan-eden-portfolio-full"
echo "🗑️ Removed: dan-eden-portfolio-full"
fi
if [ -d "./test-sites/simple/test-simple-auto-enhanced" ]; then
rm -rf "./test-sites/simple/test-simple-auto-enhanced"
echo "🗑️ Removed: test-simple-auto-enhanced"
fi
if [ -d "./test-sites/simple/test-simple-full" ]; then
rm -rf "./test-sites/simple/test-simple-full"
echo "🗑️ Removed: test-simple-full"
# Clean up legacy directories in simple subdirectory
if [ -d "./demos/simple" ] && [ -z "$(find ./demos/simple -maxdepth 1 -name '*.html' -o -name '*.yaml')" ]; then
# If simple directory exists but contains no HTML/YAML files, it's legacy
rm -rf "./demos/simple"/* 2>/dev/null || true
fi