-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
82 lines (67 loc) · 2.09 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
.SILENT:
.PHONY: build
## Colors
COLOR_RESET = \033[0m
COLOR_INFO = \033[32m
COLOR_COMMENT = \033[33m
## Show Help
help:
printf "${COLOR_COMMENT}Usage:${COLOR_RESET}\n"
printf " make [target]\n\n"
printf "${COLOR_COMMENT}Available targets:${COLOR_RESET}\n"
awk '/^[a-zA-Z-]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${COLOR_INFO}%-16s${COLOR_RESET} %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
##########
# Docker #
##########
## Run a command within the docker container (plugin directory)
docker:
docker compose exec -w "/var/www/html/custom/static-plugins/plugin" shopware ${COMMAND}
## Run a command within the docker container (base directory)
docker-base:
docker compose exec shopware ${COMMAND}
## Start a bash shell within a php docker environment
shell:
make docker-base COMMAND="bash"
############
# Building #
############
## Install all dependencies
dependencies:
make docker COMMAND="composer install --no-interaction --optimize-autoloader"
make docker COMMAND="npm install"
## Install all dependencies and prepare everything
install:
make dependencies
make docker-base COMMAND="composer config minimum-stability dev"
make docker-base COMMAND="composer require basecom/sw6-fixtures-plugin:*"
make docker-base COMMAND="./bin/console plugin:refresh"
make docker-base COMMAND="./bin/console plugin:install --activate BasecomFixturePlugin"
###########
# Linting #
###########
## Run all linting and static code analysis tools
lint:
make lint-php-cs-fixer
make lint-phpstan
make lint-psalm
make lint-prettier
## PHP CS fixer
lint-php-cs-fixer:
make docker COMMAND="./vendor/bin/php-cs-fixer fix"
## PHPStan
lint-phpstan:
make docker COMMAND="./vendor/bin/phpstan analyse --memory-limit=1G"
## Psaml
lint-psalm:
make docker COMMAND="./vendor/bin/psalm --show-info=false"
## Prettier
lint-prettier:
make docker COMMAND="./node_modules/.bin/prettier --write \"src/**/*.{js,scss,yaml,yml,json,md,ts}\""