Files
insertr/test-hot-reload.sh
Joakim ca3df47451 feat: complete code cleanup and create feature parity plan
Major Architecture Improvements:
- Separate JavaScript library (lib/) with proper build system
- Go CLI with embedded library using go:embed
- Hot reload development with Air integration
- Library + CLI build pipeline with npm run build

Code Cleanup:
- Remove obsolete assets (insertr-cli/assets/editor/)
- Clean up package.json metadata and dependencies
- Update .gitignore for new architecture
- Remove unused 'marked' dependency

New Documentation:
- Add comprehensive TODO.md with feature gap analysis
- Document critical gaps between prototype and current library
- Create phased implementation plan for feature parity
- Update DEVELOPMENT.md with hot reload workflow
- Add LIBRARY.md documenting new architecture

Hot Reload System:
- Air watches both Go CLI and JavaScript library
- Library changes trigger: rebuild → copy → CLI rebuild → serve
- Seamless development experience across full stack

Next Steps:
- Current library is basic proof-of-concept (prompt() editing)
- Archived prototype has production-ready features
- Phase 1 focuses on professional forms and authentication
- Phase 2 adds validation and content persistence
2025-09-03 19:11:54 +02:00

46 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Test script to demonstrate Air hot reload functionality
# Shows how library changes automatically trigger CLI rebuild
echo "🧪 Testing Insertr Hot Reload Functionality"
echo "============================================"
cd insertr-cli
echo "1. Starting Air in background..."
air &
AIR_PID=$!
sleep 5
echo "2. Making a test change to the library..."
cd ../lib/src
# Make a test change
sed -i 's/Hot Reload Ready/Hot Reload TESTED/g' index.js
echo "3. Waiting for Air to detect change and rebuild..."
sleep 8
echo "4. Testing if the change was embedded in CLI..."
cd ../insertr-cli
if ./insertr enhance ../demo-site/ -o /tmp/test-output 2>/dev/null && grep -q "Hot Reload TESTED" /tmp/test-output/index.html; then
echo "✅ SUCCESS: Library change was automatically embedded in CLI!"
else
echo "❌ FAILED: Library change was not embedded"
fi
echo "5. Reverting test change..."
cd ../lib/src
sed -i 's/Hot Reload TESTED/Hot Reload Ready/g' index.js
echo "6. Stopping Air..."
kill $AIR_PID 2>/dev/null
wait $AIR_PID 2>/dev/null
echo ""
echo "🎉 Hot reload test completed!"
echo " Library changes automatically trigger:"
echo " • Library rebuild (npm run build)"
echo " • Asset copy to CLI"
echo " • CLI rebuild with embedded library"
echo " • Development server restart"