-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
148 lines (119 loc) · 5.27 KB
/
Copy pathMakefile
File metadata and controls
148 lines (119 loc) · 5.27 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
BOLD := \033[1m
RESET := \033[0m
GREEN := \033[1;32m
# -- Docker
# Get the current user ID to use for docker run and docker exec commands
COMPOSE = docker compose
COMPOSE_RUN = $(COMPOSE) run --build --rm
# ==============================================================================
# RULES
default: help
bootstrap: ## Prepare the project for local development
@echo "$(BOLD)"
@echo "╔══════════════════════════════════════════════════════════════════════════════╗"
@echo "║ ║"
@echo "║ 🚀 Welcome to Help Center! 🚀 ║"
@echo "║ ║"
@echo "║ This will set up your development environment with : ║"
@echo "║ • Docker containers for all services ║"
@echo "║ • Frontend dependencies ║"
@echo "║ • Environment configuration files ║"
@echo "║ ║"
@echo "║ Services will be available at: ║"
@echo "║ • Frontend: http://localhost:8990 ║"
@echo "║ ║"
@echo "╚══════════════════════════════════════════════════════════════════════════════╝"
@echo "$(RESET)"
@echo "$(GREEN)Starting bootstrap process...$(RESET)"
@echo ""
@$(MAKE) update
@$(MAKE) start
@echo ""
@echo "$(GREEN)🎉 Bootstrap completed successfully!$(RESET)"
@echo ""
@echo "$(BOLD)Next steps:$(RESET)"
@echo " • Visit http://localhost:8990 to access the website"
@echo " • Run 'make help' to see all available commands"
@echo ""
.PHONY: bootstrap
update: ## Update the project dependencies
update: \
create-env-files \
front-install-deps
.PHONY: update
create-env-files: ## Create the environment configuration files
touch .env.local
.PHONY: create-env-files
start: ## Start the development environment
$(COMPOSE) up -d --build frontend-dev
@echo "$(GREEN)Frontend development environment started!$(RESET)"
@echo "$(BOLD)Next steps:$(RESET)"
@echo " • Visit http://localhost:8990 to access the website"
@echo " • Run 'make help' to see all available commands"
@echo ""
.PHONY: start
stop: ## Stop the development environment
$(COMPOSE) stop
.PHONY: stop
logs: ## Display all services logs (follow mode)
@$(COMPOSE) logs -f
.PHONY: logs
restart: ## Restart the development environment
$(MAKE) stop
$(MAKE) start
.PHONY: restart
reindex: ## Reindex CMS content into Redis (dev env must be running)
$(COMPOSE) exec frontend-dev npm run reindex
.PHONY: reindex
# ==============================================================================
# LINTING AND TESTING
lint: ## Lint and format code
lint: \
front-lint
.PHONY: lint
lint-check: ## Check code linting without fixing
lint-check: \
front-lint-check
.PHONY: lint-check
# ==============================================================================
# FRONTEND DEVELOPMENT
front-shell: ## Open a shell in the frontend container
$(COMPOSE_RUN) frontend-dev bash
.PHONY: front-shell
front-install-deps: ## Install the frontend dependencies with the lockfile
$(COMPOSE_RUN) frontend-base npm ci
.PHONY: front-install-deps
front-freeze-deps: ## Freeze the frontend dependencies
rm -rf package-lock.json
$(COMPOSE_RUN) frontend-base npm install
.PHONY: front-freeze-deps
front-update-deps-check: ## Check the frontend dependencies for updates
$(COMPOSE_RUN) frontend-base npx npm-check-updates
$(COMPOSE_RUN) frontend-base npm audit
.PHONY: front-update-deps-check
front-update-deps-minor: ## Update the frontend dependencies to the minor version
$(COMPOSE_RUN) frontend-base npx npm-check-updates -t minor -u
@$(MAKE) front-freeze-deps
.PHONY: front-update-deps-minor
front-update-deps-latest: ## Update the frontend dependencies to the major version
$(COMPOSE_RUN) frontend-base npx npm-check-updates -t latest -u
@$(MAKE) front-freeze-deps
.PHONY: front-update-deps-latest
front-lint: ## Lint the frontend code
$(COMPOSE_RUN) frontend-base npm run lint
.PHONY: front-lint
front-lint-check: ## Check the frontend code linting without fixing
$(COMPOSE_RUN) frontend-base npm run lint:check
.PHONY: front-lint-check
front-test: ## Run the frontend test suite
$(COMPOSE_RUN) frontend-base npm test
.PHONY: front-test
test: ## Run all tests
test: \
front-test
.PHONY: test
help:
@echo "$(BOLD)Makefile help$(RESET)"
@echo "Please use 'make $(BOLD)target$(RESET)' where $(BOLD)target$(RESET) is one of:"
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "$(GREEN)%-30s$(RESET) %s\n", $$1, $$2}'
.PHONY: help