-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (86 loc) · 3.7 KB
/
Makefile
File metadata and controls
104 lines (86 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Makefile for Hugo website management with automatic CDN header generation
.DEFAULT_GOAL := help
# Check if Node.js is installed
NODE_AVAILABLE := $(shell which node >/dev/null 2>&1 && echo 1 || echo 0)
# ==============================================================================
# SETUP & INSTALLATION
# ==============================================================================
install: ## Install project dependencies
ifeq ($(NODE_AVAILABLE),1)
@echo "Installing npm dependencies..."
npm install
else
@echo "⚠️ Node.js not found. Please install Node.js to use automated header generation."
@echo "🔗 Download from: https://nodejs.org/"
endif
# ==============================================================================
# DEVELOPMENT
# ==============================================================================
dev: ## Start development server with automatic header generation
ifeq ($(NODE_AVAILABLE),1)
@echo "🚀 Starting development server with fresh headers..."
npm run dev
else
@echo "⚠️ Using fallback Hugo server (headers won't be auto-generated)"
hugo server -D --disableFastRender
endif
serve: dev ## Alias for dev command
# ==============================================================================
# BUILD & DEPLOYMENT
# ==============================================================================
headers: ## Generate dynamic CDN headers with current timestamps
ifeq ($(NODE_AVAILABLE),1)
@echo "📝 Generating dynamic CDN headers..."
npm run headers
else
@echo "⚠️ Node.js required for automatic header generation"
@echo "🔗 Install Node.js or use static headers"
endif
build: ## Build the static site with automatic header generation
ifeq ($(NODE_AVAILABLE),1)
@echo "🏗️ Building site with automated header generation..."
npm run build
else
@echo "⚠️ Building without automated headers (Node.js not available)"
hugo --gc --minify
endif
build-production: ## Build for production with optimized headers
ifeq ($(NODE_AVAILABLE),1)
@echo "🚀 Building production site with CDN-optimized headers..."
npm run build:production
else
@echo "⚠️ Building without automated headers (Node.js not available)"
hugo --environment production --gc --minify
endif
# ==============================================================================
# MAINTENANCE & UTILITIES
# ==============================================================================
clean: ## Remove generated directories (public, resources)
@echo "🧹 Cleaning up generated files..."
rm -rf public resources
clean-headers: ## Remove generated headers file
@echo "🗑️ Removing generated headers..."
rm -f static/_headers
clean-all: clean clean-headers ## Remove all generated files including headers
# ==============================================================================
# HELP
# ==============================================================================
help: ## Show this help message
@echo ""
@echo "🏗️ Hartza Capital Website - Build Commands"
@echo "==========================================="
@echo ""
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@echo ""
@echo "💡 Quick Start:"
@echo " make install # Install dependencies"
@echo " make dev # Start development"
@echo " make build # Build for staging/testing"
@echo " make build-production # Build for production"
@echo ""
@echo "📦 Deployment:"
@echo " GitHub Actions automatically deploys:"
@echo " - 'develop' branch → Staging environment"
@echo " - 'main' branch → Production environment"
@echo ""
.PHONY: install dev serve headers build build-production clean clean-headers clean-all help