-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
99 lines (90 loc) · 3.04 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
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
# define standard colors
ifneq (,$(findstring xterm,${TERM}))
BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
LIGHTPURPLE := $(shell tput -Txterm setaf 4)
PURPLE := $(shell tput -Txterm setaf 5)
BLUE := $(shell tput -Txterm setaf 6)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
else
BLACK := ""
RED := ""
GREEN := ""
YELLOW := ""
LIGHTPURPLE := ""
PURPLE := ""
BLUE := ""
WHITE := ""
RESET := ""
endif
# 👆https://gist.github.com/rsperl/d2dfe88a520968fbc1f49db0a29345b9
.PHONY: build dev composer craft npm pull up install
build: up
@echo "Preparing to build..."
@ddev exec npm run build
dev: up
@ddev exec npm run dev
fix-scripts: up
@ddev exec npm run fix-scripts
fix-styles: up
@ddev exec npm run fix-styles
browserslist: up
@ddev exec npx browserslist
composer: up
@ddev composer \
$(filter-out $@,$(MAKECMDGOALS))
craft: up
@ddev exec php craft \
$(filter-out $@,$(MAKECMDGOALS))
npm: up
@ddev exec npm \
$(filter-out $@,$(MAKECMDGOALS))
install: up
@echo ""
@echo "Preparing to install Craft..."
# 👇 set_primary_site_url executes a custom command (shell script) within the web container which
# sets the default PRIMARY_SITE_URL of your Craft .env file to match your DDEV site name ${DDEV_SITENAME}.
# View the script in .ddev/commands/web/set_primary_site_url.sh
#
# Custom commands in DDEV are extremely powerful and easy to implement.
# https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/
@ddev set_primary_site_url
@ddev exec php craft setup/app-id \
$(filter-out $@,$(MAKECMDGOALS))
@ddev exec php craft setup/security-key \
$(filter-out $@,$(MAKECMDGOALS))
@echo ""
@ddev exec php craft install \
$(filter-out $@,$(MAKECMDGOALS))
@echo ""
@echo "Installing plugins..."
# 👇 You can expand this list of plugins however you like.
# Just remember to update requirements in composer.json.default
@ddev exec php craft plugin/install ckeditor
@ddev exec php craft plugin/install image-resizer
@ddev exec php craft plugin/install imgixer
@ddev exec php craft plugin/install postmark
@ddev exec php craft plugin/install preparse-field
@ddev exec php craft plugin/install sprig
@ddev exec php craft plugin/install vite
# Finish up
@echo "*** DONE ***"
@ddev describe
up:
@echo "${PURPLE}Preflight check...${RESET}"
# 👇 We'll grep for some strings ("web" and "OK") to understand if DDEV is already running
@if [ ! "$$(ddev describe | grep -e web -e OK )" ]; then \
echo "Your DDEV project is ${GREEN}starting...${RESET}"; \
ddev auth ssh; \
ddev start; \
ddev composer install; \
ddev exec npm install --loglevel=error --no-fund; \
else \
echo "${YELLOW}Your DDEV project is already running.${RESET}"; \
fi
%:
@:
# ref: https://stackoverflow.com/questions/6273608/how-to-pass-argument-to-makefile-from-command-line