- Hugo site configured and working - Story page with interactive collapsible timeline - CSS styling for journey/timeline layout - JavaScript for dynamic markdown-to-timeline conversion - Theme with responsive design - Content structure for Bitcoin education site Features: - Collapsible year sections with animations - Quick jump navigation between years - Mobile responsive design - Interactive timeline functionality
148 lines
No EOL
3.8 KiB
Bash
Executable file
148 lines
No EOL
3.8 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Development script for dontbechad.com
|
|
# This script helps with local development and testing
|
|
|
|
set -e
|
|
|
|
echo "🚀 Don't Be Chad Development Script"
|
|
echo "================================="
|
|
|
|
# Check if Hugo is installed
|
|
if ! command -v hugo &> /dev/null; then
|
|
echo "❌ Hugo is not installed. Please install Hugo first:"
|
|
echo " https://gohugo.io/getting-started/installing/"
|
|
exit 1
|
|
fi
|
|
|
|
# Function to start development server
|
|
start_dev() {
|
|
echo "🔧 Starting Hugo development server..."
|
|
hugo server -D --bind 0.0.0.0 --port 1313
|
|
}
|
|
|
|
# Function to build for production
|
|
build_prod() {
|
|
echo "🏗️ Building for production..."
|
|
hugo --minify
|
|
echo "✅ Site built successfully in public/ directory"
|
|
}
|
|
|
|
# Function to check content
|
|
check_content() {
|
|
echo "📝 Checking content structure..."
|
|
|
|
# Check for required files
|
|
required_files=(
|
|
"content/_index.md"
|
|
"content/about.md"
|
|
"content/mistakes/_index.md"
|
|
"content/guides/_index.md"
|
|
"hugo.yaml"
|
|
)
|
|
|
|
for file in "${required_files[@]}"; do
|
|
if [[ -f "$file" ]]; then
|
|
echo "✅ $file exists"
|
|
else
|
|
echo "❌ $file missing"
|
|
fi
|
|
done
|
|
|
|
# Check for images directory
|
|
if [[ -d "static/images" ]]; then
|
|
echo "✅ Images directory exists"
|
|
else
|
|
echo "⚠️ Images directory missing (create if needed)"
|
|
fi
|
|
}
|
|
|
|
# Function to validate links
|
|
validate_links() {
|
|
echo "🔗 Validating internal links..."
|
|
# Note: This would require additional tooling
|
|
echo "⚠️ Link validation requires additional setup"
|
|
}
|
|
|
|
# Function to run security checks
|
|
security_check() {
|
|
echo "🔒 Running security checks..."
|
|
|
|
# Check for sensitive files
|
|
sensitive_patterns=(
|
|
"*.key"
|
|
"*.pem"
|
|
"id_rsa"
|
|
".env"
|
|
"password"
|
|
)
|
|
|
|
echo "Checking for sensitive files..."
|
|
find . -name "*.key" -o -name "*.pem" -o -name "id_rsa" -o -name ".env" | grep -v node_modules || echo "✅ No sensitive files found"
|
|
|
|
# Check for hardcoded secrets
|
|
echo "Checking for hardcoded secrets..."
|
|
grep -r "password\|secret\|key\|token" content/ static/ --include="*.md" --include="*.js" --include="*.css" | grep -v "bitcoin\|Bitcoin" || echo "✅ No hardcoded secrets found"
|
|
}
|
|
|
|
# Function to optimize images
|
|
optimize_images() {
|
|
echo "🖼️ Optimizing images..."
|
|
if [[ -d "static/images" ]]; then
|
|
echo "Found images directory. Consider optimizing images before deployment."
|
|
else
|
|
echo "No images directory found."
|
|
fi
|
|
}
|
|
|
|
# Function to deploy preview
|
|
deploy_preview() {
|
|
echo "🚀 Deploying preview build..."
|
|
build_prod
|
|
|
|
# Check if netlify CLI is installed
|
|
if command -v netlify &> /dev/null; then
|
|
netlify deploy --dir=public --message="Development preview"
|
|
else
|
|
echo "⚠️ Netlify CLI not installed. Install with: npm install -g netlify-cli"
|
|
fi
|
|
}
|
|
|
|
# Main menu
|
|
case "${1:-dev}" in
|
|
"dev")
|
|
start_dev
|
|
;;
|
|
"build")
|
|
build_prod
|
|
;;
|
|
"check")
|
|
check_content
|
|
;;
|
|
"security")
|
|
security_check
|
|
;;
|
|
"optimize")
|
|
optimize_images
|
|
;;
|
|
"preview")
|
|
deploy_preview
|
|
;;
|
|
"help"|"-h"|"--help")
|
|
echo "Usage: $0 [command]"
|
|
echo ""
|
|
echo "Commands:"
|
|
echo " dev Start development server (default)"
|
|
echo " build Build for production"
|
|
echo " check Check content structure"
|
|
echo " security Run security checks"
|
|
echo " optimize Optimize images"
|
|
echo " preview Deploy preview build"
|
|
echo " help Show this help message"
|
|
;;
|
|
*)
|
|
echo "❌ Unknown command: $1"
|
|
echo "Use '$0 help' for available commands"
|
|
exit 1
|
|
;;
|
|
esac |