forked from next-sentence/SyliusRichEditorPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
157 lines (118 loc) · 4.17 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
.DEFAULT_GOAL := help
SHELL=/bin/bash
APP_DIR=tests/Application
SYMFONY=cd ${APP_DIR} && symfony
COMPOSER=symfony composer
CONSOLE=${SYMFONY} console
export COMPOSE_PROJECT_NAME=rich-editor
COMPOSE=docker-compose
YARN=yarn
PHPSTAN=symfony php vendor/bin/phpstan
PHPUNIT=symfony php vendor/bin/phpunit
PHPSPEC=symfony php vendor/bin/phpspec
###
### DEVELOPMENT
### ¯¯¯¯¯¯¯¯¯¯¯
install: platform sylius ## Install the plugin
.PHONY: install
up: docker.up server.start ## Up the project (start docker, start symfony server)
stop: server.stop docker.stop ## Stop the project (stop docker, stop symfony server)
down: server.stop docker.down ## Down the project (removes docker containers, stop symfony server)
reset: docker.down ## Stop docker and remove dependencies
rm -rf ${APP_DIR}/node_modules ${APP_DIR}/yarn.lock
rm -rf vendor composer.lock
.PHONY: reset
dependencies: vendor node_modules ## Setup the dependencies
.PHONY: dependencies
.php-version: .php-version.dist
cp .php-version.dist .php-version
(cd ${APP_DIR} && ln -sf ../../.php-version)
vendor: composer.lock ## Install the PHP dependencies using composer
ifdef GITHUB_ACTIONS
${COMPOSER} install --prefer-dist
else
${COMPOSER} install --prefer-source
endif
composer.lock: composer.json
ifdef GITHUB_ACTIONS
${COMPOSER} update --prefer-dist
else
${COMPOSER} update --prefer-source
endif
yarn.install: ${APP_DIR}/yarn.lock
${APP_DIR}/yarn.lock:
ln -sf ${APP_DIR}/node_modules node_modules
cd ${APP_DIR} && ${YARN} install && ${YARN} build
${YARN} install
${YARN} encore prod
node_modules: ${APP_DIR}/node_modules ## Install the Node dependencies using yarn
${APP_DIR}/node_modules: yarn.install
###
### TESTS
### ¯¯¯¯¯
test.all: test.composer test.phpstan test.phpunit test.phpspec test.phpcs test.yaml test.schema test.twig ## Run all tests in once
test.composer: ## Validate composer.json
${COMPOSER} validate --strict
test.phpstan: ## Run PHPStan
${PHPSTAN} analyse -c phpstan.neon src/
test.phpunit: ## Run PHPUnit
${PHPUNIT}
test.phpspec: ## Run PHPSpec
${PHPSPEC} run
test.phpcs: ## Run PHP CS Fixer in dry-run
${COMPOSER} run -- phpcs --dry-run -v
test.phpcs.fix: ## Run PHP CS Fixer and fix issues if possible
${COMPOSER} run -- phpcs -v
test.container: ## Lint the symfony container
${CONSOLE} lint:container
test.yaml: ## Lint the symfony Yaml files
${CONSOLE} lint:yaml ../../recipes ../../src/Resources/config
test.schema: ## Validate MySQL Schema
${CONSOLE} doctrine:schema:validate
test.twig: ## Validate Twig templates
${CONSOLE} lint:twig --no-debug templates/ ../../src/Resources/views/
###
### SYLIUS
### ¯¯¯¯¯¯
sylius: dependencies sylius.database sylius.fixtures sylius.assets ## Install Sylius
.PHONY: sylius
sylius.database: ## Setup the database
${CONSOLE} doctrine:database:drop --if-exists --force
${CONSOLE} doctrine:database:create --if-not-exists
${CONSOLE} doctrine:migration:migrate -n
sylius.fixtures: ## Run the fixtures
${CONSOLE} sylius:fixtures:load -n default
sylius.assets: ## Install all assets with symlinks
${CONSOLE} assets:install --symlink
${CONSOLE} sylius:install:assets
${CONSOLE} sylius:theme:assets:install --symlink
###
### PLATFORM
### ¯¯¯¯¯¯¯¯
platform: .php-version up ## Setup the platform tools
.PHONY: platform
docker.pull: ## Pull the docker images
cd ${APP_DIR} && ${COMPOSE} pull
docker.up: ## Start the docker containers
cd ${APP_DIR} && ${COMPOSE} up -d
.PHONY: docker.up
docker.stop: ## Stop the docker containers
cd ${APP_DIR} && ${COMPOSE} stop
.PHONY: docker.stop
docker.down: ## Stop and remove the docker containers
cd ${APP_DIR} && ${COMPOSE} down
.PHONY: docker.down
server.start: ## Run the local webserver using Symfony
${SYMFONY} local:server:start -d
server.stop: ## Stop the local webserver
${SYMFONY} local:server:stop
###
### HELP
### ¯¯¯¯
help: SHELL=/bin/bash
help: ## Dislay this help
@IFS=$$'\n'; for line in `grep -h -E '^[a-zA-Z_#-]+:?.*?##.*$$' $(MAKEFILE_LIST)`; do if [ "$${line:0:2}" = "##" ]; then \
echo $$line | awk 'BEGIN {FS = "## "}; {printf "\033[33m %s\033[0m\n", $$2}'; else \
echo $$line | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m%s\n", $$1, $$2}'; fi; \
done; unset IFS;
.PHONY: help