forked from mollie/Shopware6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
184 lines (151 loc) · 8.56 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
#
# Makefile
#
.PHONY: help
.DEFAULT_GOAL := help
PLUGIN_VERSION=`php -r 'echo json_decode(file_get_contents("MolliePayments/composer.json"))->version;'`
SW_CLI_VERSION:=$(shell shopware-cli --version 1>/dev/null)
NODE_VERSION:=$(shell node -v)
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# ------------------------------------------------------------------------------------------------------------
prod: ## Installs all production dependencies
# do not switch to production composer PROD, otherwise it would
# also install shopware in here -> we just need it for the release composer.json file
# so just switch to our dev dependency variant
php switch-composer.php dev
# ----------------------------------------------------------------
@composer validate
@composer install --no-dev
cd src/Resources/app/administration && npm install --omit=dev
cd src/Resources/app/storefront && npm install --omit=dev
dev: ## Installs all dev dependencies
php switch-composer.php dev
@composer validate
# we have to run update in dev mode, because dev dependencies are not compatible with newer php version. should be updated when support for 6.4 is dropped
@composer update
cd src/Resources/app/administration && npm install
cd src/Resources/app/storefront && npm install
curl -1sLf 'https://dl.cloudsmith.io/public/friendsofshopware/stable/setup.deb.sh' | sudo -E bash && sudo apt install -y --allow-downgrades shopware-cli=0.3.18
install: ## [deprecated] Installs all production dependencies. Please use "make prod" now.
@make prod -B
clean: ## Cleans all dependencies and files
rm -rf vendor/*
# ------------------------------------------------------
rm -rf .reports | true
# ------------------------------------------------------
rm -rf ./src/Resources/app/administration/node_modules/*
rm -rf ./src/Resources/app/storefront/node_modules/*
# ------------------------------------------------------
rm -rf ./src/Resources/app/storefront/dist/storefront
# ------------------------------------------------------
rm -rf ./src/Resources/public/administration
rm -rf ./src/Resources/public/mollie-payments.js
build: ## Installs the plugin, and builds the artifacts using the Shopware build commands.
# -----------------------------------------------------
# CUSTOM WEBPACK
php switch-composer.php dev
cd ./src/Resources/app/storefront && make build -B
# -----------------------------------------------------
php switch-composer.php prod
cd ../../.. && export NODE_OPTIONS=--openssl-legacy-provider && shopware-cli extension build custom/plugins/MolliePayments
php switch-composer.php dev
# -----------------------------------------------------
cd ../../.. && php bin/console --no-debug theme:refresh
cd ../../.. && php bin/console --no-debug theme:compile
cd ../../.. && php bin/console --no-debug theme:refresh
cd ../../.. && php bin/console --no-debug assets:install
cd ../../.. && php bin/console --no-debug cache:clear
fixtures: ## Installs all available testing fixtures of the Mollie plugin
cd ../../.. && php bin/console --no-debug cache:clear
cd ../../.. && php bin/console --no-debug fixture:load:group mollie
# ------------------------------------------------------------------------------------------------------------
phpcheck: ## Starts the PHP syntax checks
@find . -name '*.php' -not -path "./vendor/*" -not -path "./tests/*" | xargs -n 1 -P4 php -l
phpmin: ## Starts the PHP compatibility checks
@php vendor/bin/phpcs -p --standard=PHPCompatibility --extensions=php --runtime-set testVersion 7.2 ./src
csfix: ## Starts the PHP CS Fixer
@PHP_CS_FIXER_IGNORE_ENV=1 php vendor/bin/php-cs-fixer fix --config=./.php_cs.php --dry-run
stan: ## Starts the PHPStan Analyser
@php vendor/bin/phpstan analyse -c ./.phpstan.neon
phpunit: ## Starts all PHPUnit Tests
@XDEBUG_MODE=coverage php vendor/bin/phpunit --configuration=phpunit.xml --coverage-html ./.reports/phpunit/coverage
infection: ## Starts all Infection/Mutation tests
@XDEBUG_MODE=coverage php vendor/bin/infection --configuration=./.infection.json --log-verbosity=all --debug
insights: ## Starts the PHPInsights Analyser
@php vendor/bin/phpinsights analyse --no-interaction
jest: ## Starts all Jest tests
cd ./src/Resources/app/administration && ./node_modules/.bin/jest --config=.jest.config.js --coverage
cd ./src/Resources/app/storefront && ./node_modules/.bin/jest --config=.jest.config.js --coverage
stryker: ## Starts the Stryker Jest Mutation Tests
cd ./src/Resources/app/administration && ./node_modules/.bin/stryker run .stryker.conf.json
@# Storefront has no tests at the moment
@# cd ./src/Resources/app/storefront && ./node_modules/.bin/stryker run .stryker.conf.json
eslint: ## Starts the ESLinter
cd ./src/Resources/app/administration && ./node_modules/.bin/eslint --config ./.eslintrc.json ./src
cd ./src/Resources/app/storefront && ./node_modules/.bin/eslint --config ./.eslintrc.json ./src
stylelint: ## Starts the Stylelinter
cd ./src/Resources/app/administration && ./node_modules/.bin/stylelint --allow-empty-input ./src/**/*.scss
cd ./src/Resources/app/storefront && ./node_modules/.bin/stylelint --allow-empty-input ./src/**/*.scss
configcheck: ## Tests and verifies the plugin configuration file
cd ./tests/Custom && php verify-plugin-config.php
# ------------------------------------------------------------------------------------------------------------
snippetcheck: ## Tests and verifies all plugin snippets
php vendor/bin/phpunuhi validate --configuration=./.phpunuhi.xml --report-format=junit --report-output=./.phpunuhi/junit.xml
snippetexport: ## Exports all snippets
php vendor/bin/phpunuhi export --configuration=./.phpunuhi.xml --dir=./.phpunuhi
snippetimport: ## Imports the provided snippet set [set=xyz file=xz.csv]
php vendor/bin/phpunuhi import --configuration=./.phpunuhi.xml --set=$(set) --file=$(file) --intent=1
# ------------------------------------------------------------------------------------------------------------
pr: ## Prepares everything for a Pull Request
@PHP_CS_FIXER_IGNORE_ENV=1 php vendor/bin/php-cs-fixer fix --config=./.php_cs.php
@make phpcheck -B
@make phpmin -B
@make stan -B
@make phpunit -B
@make infection -B
@make jest -B
@make stryker -B
@make eslint -B
@make stylelint -B
@make configcheck -B
@make snippetcheck -B
# -------------------------------------------------------------------------------------------------
release: ## Builds a PROD version and creates a ZIP file in plugins/.build.
ifneq (,$(findstring v12,$(NODE_VERSION)))
$(warning Attention, reqruires Node v14 or higher to build a release!)
@exit 1
endif
cd .. && rm -rf ./.build/MolliePayments* && mkdir -p ./.build
# -------------------------------------------------------------------------------------------------
@echo "UPDATE SHOPWARE DEPENDENCIES"
php switch-composer.php dev
composer update shopware/core
composer update shopware/storefront
composer update shopware/administration
# -------------------------------------------------------------------------------------------------
@echo "INSTALL DEV DEPENDENCIES AND BUILD"
make clean -B
make dev -B
make build -B
# -------------------------------------------------------------------------------------------------
@echo "INSTALL PRODUCTION DEPENDENCIES"
make prod -B
rm -rf ./src/Resources/app/storefront/node_modules/*
# DELETE distribution file. that ones not compatible between 6.5 and 6.4
# if one wants to use it, they need to run build-storefront.sh manually and activate that feature
# in our plugin configuration! (use shopware standard js)
rm -rf ./src/Resources/app/storefront/dist/storefront
# switch to PROD dependencies before zipping plugin
# this is very important for the Shopware Store.
php switch-composer.php prod
# -------------------------------------------------------------------------------------------------
@echo "CREATE ZIP FILE"
cd .. && zip -qq -r -0 ./.build/MolliePayments.zip MolliePayments/* -x '*.editorconfig' '*.git*' '*.reports*' '*/.idea*' '*/tests*' '*/node_modules*' '*/makefile' '*.DS_Store' '*/.shopware-extension.yml' '*/switch-composer.php' '*/phpunit.xml' '*/.phpunuhi.xml' '*/.infection.json' '*/phpunit.autoload.php' '*/.phpstan*' '*/.php_cs.php' '*/phpinsights.php'
# -------------------------------------------------------------------------------------------------
@echo "RESET COMPOSER.JSON"
php switch-composer.php dev
# -------------------------------------------------------------------------------------------------
@echo ""
@echo "CONGRATULATIONS"
@echo "The new ZIP file is available at plugins/.build/MolliePayments.zip"