-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
46 lines (37 loc) · 1.14 KB
/
Makefile
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
# Styles
YELLOW=$(shell echo "\033[00;33m")
RED=$(shell echo "\033[00;31m")
RESTORE=$(shell echo "\033[0m")
# Variables
NPM := pnpm
CADDY := caddy
CADDY_PID_FILE := caddy.dev.pid
CADDYFILE := Caddyfile
.DEFAULT_GOAL := list
.PHONY: list
list:
@echo "******************************"
@echo "${YELLOW}Available targets${RESTORE}:"
@grep -E '^[a-zA-Z-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " ${YELLOW}%-15s${RESTORE} > %s\n", $$1, $$2}'
@echo "${RED}==============================${RESTORE}"
.PHONY: clean
clean: stop ## Clean non-essential files
@rm -rf node_modules
.PHONY: install
install: ## Install dependencies
@$(NPM) install
.PHONY: serve-https
serve-https: ## Start the HTTPS proxy
@$(CADDY) start --config $(CADDYFILE) --pidfile $(CADDY_PID_FILE)
.PHONY: serve-front
serve-front: ## Serve the Frontend
@$(NPM) run dev
.PHONY: stop
stop: ## Stop all the local services you need
-@$(CADDY) stop > /dev/null 2>&1 &
-@if [ -f $(CADDY_PID_FILE) ]; then \
kill -9 `cat $(CADDY_PID_FILE)`; \
rm -f $(CADDY_PID_FILE); \
fi
.PHONY: serve
serve: stop serve-https serve-front ## Run all the local services you need