- 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
236 lines
6.8 KiB
Makefile
236 lines
6.8 KiB
Makefile
# Insertr Development Commands
|
|
# Use `just <command>` to run any of these tasks
|
|
|
|
# Default recipe - show available commands
|
|
default:
|
|
@just --list
|
|
|
|
# Install all dependencies (root + lib)
|
|
install:
|
|
npm install
|
|
cd lib && npm install
|
|
|
|
# Start full-stack development (primary workflow)
|
|
dev: build-lib build
|
|
#!/usr/bin/env bash
|
|
echo "🚀 Starting Full-Stack Insertr Development..."
|
|
echo "================================================"
|
|
echo ""
|
|
|
|
# Note: Sites are auto-enhanced by the server on startup
|
|
|
|
echo ""
|
|
echo "🔌 Starting Insertr server with all sites..."
|
|
echo ""
|
|
|
|
# Function to cleanup background processes
|
|
cleanup() {
|
|
echo ""
|
|
echo "🛑 Shutting down server..."
|
|
kill $SERVER_PID 2>/dev/null || true
|
|
wait $SERVER_PID 2>/dev/null || true
|
|
echo "✅ Shutdown complete"
|
|
exit 0
|
|
}
|
|
trap cleanup SIGINT SIGTERM
|
|
|
|
# Start server (serves API + all static sites)
|
|
INSERTR_DATABASE_PATH=./insertr.db ./insertr serve --dev-mode &
|
|
SERVER_PID=$!
|
|
|
|
echo ""
|
|
echo "🌐 All sites available at:"
|
|
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-portfolio/"
|
|
echo ""
|
|
echo "📝 Full-stack ready - edit content with real-time persistence!"
|
|
echo "🔄 Press Ctrl+C to shutdown"
|
|
echo ""
|
|
|
|
# Wait for server process
|
|
wait $SERVER_PID
|
|
|
|
# Start development server for about page
|
|
dev-about: build-lib build
|
|
#!/usr/bin/env bash
|
|
echo "🚀 Starting full-stack development..."
|
|
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
|
|
check:
|
|
npm run 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/default/ - Main demo site"
|
|
@echo " http://localhost:8080/sites/simple/ - Simple test site"
|
|
@echo " http://localhost:8080/sites/dan-eden-portfolio/ - Dan Eden portfolio"
|
|
@echo ""
|
|
@echo "🚀 To start the development server:"
|
|
@echo " just dev"
|
|
|
|
# Build the entire project (library + unified binary)
|
|
build:
|
|
npm run build
|
|
|
|
# Build only the JavaScript library
|
|
build-lib:
|
|
npm run build:lib
|
|
|
|
# Watch library files for changes (auto-rebuild)
|
|
watch:
|
|
cd lib && npm run dev
|
|
|
|
# Start Air hot-reload for unified binary development
|
|
air:
|
|
air
|
|
|
|
# Build unified binary only
|
|
build-insertr:
|
|
go build -o insertr .
|
|
|
|
# Run insertr help
|
|
help:
|
|
./insertr --help
|
|
|
|
|
|
|
|
# Enhance demo site (build-time content injection)
|
|
enhance input="demos/default" output="dist":
|
|
./insertr enhance {{input}} --output {{output}} --mock
|
|
|
|
# === Content API Server Commands ===
|
|
|
|
# Start content API server (default port 8080)
|
|
serve port="8080":
|
|
INSERTR_DATABASE_PATH=./insertr.db ./insertr serve --port {{port}} --dev-mode
|
|
|
|
# Start API server in production mode
|
|
serve-prod port="8080" db="./insertr.db":
|
|
INSERTR_DATABASE_PATH={{db}} ./insertr serve --port {{port}}
|
|
|
|
|
|
|
|
# Check API server health
|
|
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
|
|
clean:
|
|
rm -rf lib/dist
|
|
rm -rf insertr
|
|
rm -rf tmp
|
|
rm -rf dist
|
|
rm -rf node_modules
|
|
rm -rf lib/node_modules
|
|
rm -f dev.db
|
|
rm -f insertr.db
|
|
@echo "🧹 Cleaned all build artifacts"
|
|
|
|
|
|
|
|
# Lint code (placeholder for now)
|
|
lint:
|
|
npm run lint
|
|
|
|
# Run tests (placeholder for now)
|
|
test:
|
|
npm run test
|
|
|
|
# Development workflow: install deps, build lib, start dev server
|
|
dev-setup: install build-lib dev
|
|
|
|
# Production workflow: install deps, build everything
|
|
prod-build: install build
|
|
|
|
# Show project status
|
|
status:
|
|
@echo "🏗️ Insertr Project Status"
|
|
@echo "========================="
|
|
@echo "📁 Root files:"
|
|
@ls -la package.json justfile go.mod insertr.yaml 2>/dev/null || echo " Missing files"
|
|
@echo "\n📚 Library files:"
|
|
@ls -la lib/package.json lib/src lib/dist 2>/dev/null || echo " Missing library components"
|
|
@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 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)"
|
|
@echo " just demo - Show available demo sites"
|
|
@echo " just serve - API server only (localhost:8080)"
|
|
@echo " just enhance - Build-time content injection"
|
|
@echo ""
|
|
@echo "🔍 Check server: just health"
|
|
|
|
|
|
# Generate sqlc code (for database schema changes)
|
|
sqlc:
|
|
sqlc generate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Clean generated demo directories
|
|
clean-demos:
|
|
#!/usr/bin/env bash
|
|
echo "🧹 Cleaning generated demo directories..."
|
|
echo "========================================="
|
|
|
|
# Demo directories
|
|
if [ -d "./demos/default_enhanced" ]; then
|
|
rm -rf "./demos/default_enhanced"
|
|
echo "🗑️ Removed: default_enhanced"
|
|
fi
|
|
|
|
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
|
|
|
|
# Clean up any temporary directories
|
|
if [ -d "./demos/dan-eden-portfolio-temp" ]; then
|
|
rm -rf "./demos/dan-eden-portfolio-temp"
|
|
echo "🗑️ Removed: dan-eden-portfolio-temp"
|
|
fi
|
|
|
|
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 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
|
|
|
|
# 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
|
|
|
|
|
|
|
|
echo ""
|
|
echo "✅ Demo cleanup complete!"
|
|
echo "🔧 Sites will auto-enhance when you run demo commands"
|
|
|
|
|