-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
201 lines (154 loc) · 4.73 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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
.SILENT:
.PHONY: build
PORT_PREFIX = 350
PROJECT_DOMAIN = www.ela.ooo
define manala_project_host
$(PROJECT_DOMAIN)$(if $(1),:$(PORT_PREFIX)$(shell printf "%02d" $(1)))
endef
-include .manala/Makefile
## System - Setup the project for the first time with Docker
setup:
WAIT=1 make up
$(manala_docker_command) make install build.assets
$(call manala_message, Will be available at http://$(call manala_project_host, 80))
## System - Stop local system
halt: stop
###########
# Install #
###########
## Install - Install dependencies
install: install.composer install.npm
install.composer:
symfony composer install
install.npm:
npm install
## Update - Update dependencies
update: update.composer update.npm update.browserslist
update.composer:
symfony composer update
update.npm:
npm update
update.browserslist:
npx update-browserslist-db@latest
###############
# Development #
###############
ifndef MANALA_DOCKER
## Dev - Start the whole application for development purposes (local only)
serve:
# https://www.npmjs.com/package/concurrently
npx concurrently "make serve.php" "make serve.assets" --names="Symfony,Webpack" --prefix=name --kill-others --kill-others-on-fail
else
## Dev - Start the application dependant processes for development purposes (docker only)
serve:
$(call manala_message, Will be available at http://$(call manala_project_host, 80))
make serve.assets
endif
ifndef MANALA_DOCKER
## Dev - Start Symfony server
serve.php: export SYMFONY_PORT ?= $(PORT_PREFIX)80
serve.php:
$(call manala_message, Will be available at http://$(call manala_project_host):$(SYMFONY_PORT) )
-open http://www.ela.ooo:$(SYMFONY_PORT)
symfony server:start --no-tls --port=$(SYMFONY_PORT)
endif
## Dev - Start webpack dev server with HMR (Hot reload)
serve.assets: export WEBPACK_PORT ?= $(PORT_PREFIX)81
serve.assets:
npx encore dev-server \
--mode=development \
--port=$(WEBPACK_PORT) \
--host=$(PROJECT_DOMAIN)
## Dev - Watch assets
watch.assets:
npm run watch
## Clear - Clear the build dir and assets
clear.build:
rm -rf build public/build
## Clear - Clear resized images cache
clear.images:
rm -rf public/resized
#########
# Build #
#########
build: build.assets
## Build - Build assets
build.assets:
npm run build
## Build - Build static site
build.content: export APP_ENV = prod
build.content:
rm -rf public/resized
symfony console cache:clear
ulimit -S -n 2048 && symfony console stenope:build
## Build - Build static site without resizing images, for moar speed
build.content.without-images: export APP_ENV = prod
build.content.without-images: export GLIDE_PRE_GENERATE_CACHE = 0
build.content.without-images:
symfony console cache:clear
ulimit -S -n 2048 && symfony console stenope:build
## Build - Build static site with assets
build.static: build.assets build.content
## Serve - Serve the static version
serve.static:
open http://localhost:8000
symfony php -S localhost:8000 -t build
## Build - Simulates GH Pages deploy into a subdir / with base url
build.static.subdir: export APP_ENV = prod
build.static.subdir: export WEBPACK_PUBLIC_PATH = /elao_/build
build.static.subdir: export ROUTER_DEFAULT_URI = http://localhost:8001/elao_
build.static.subdir: clear.build build.assets
rm -rf public/resized
symfony console cache:clear
ulimit -S -n 2048 && symfony console stenope:build build/elao_
## Serve - Serve the static version of the site from a subdir / with base url
serve.static.subdir:
open http://localhost:8001/elao_
symfony php -S localhost:8001 -t build
########
# Lint #
########
## Lint - Lint
lint: lint.php-cs-fixer lint.phpstan lint.twig lint.yaml lint.eslint lint.container lint.composer
lint.composer:
symfony composer validate --no-check-publish
lint.container:
symfony console lint:container
lint.php-cs-fixer:
symfony php vendor/bin/php-cs-fixer fix
lint.twig:
symfony console lint:twig templates --show-deprecations
lint.yaml:
symfony console lint:yaml config translations --parse-tags
lint.phpstan: export APP_ENV = test
lint.phpstan:
symfony console cache:clear --ansi
symfony console cache:warmup --ansi
symfony php vendor/bin/phpstan analyse --memory-limit=-1
lint.eslint:
npm run fix
############
# Security #
############
security.symfony:
symfony check:security
security.npm:
npm audit ; RC=$${?} ; [ $${RC} -gt 2 ] && exit $${RC} || exit 0
#######
# SSH #
#######
ssh@production:
########
# Test #
########
## Test - Most basic test: check the build command, without images
test: build.content.without-images
test:
$(call manala_message_success, Most basic tests succeeded. You can ensure a \`make build.content\` is successful for more complete tests.)
############
# Utils #
############
## Content - Generate a new article
article:
symfony console app:generate:article