-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
109 lines (83 loc) · 4.44 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
#
# Makefile
#
.PHONY: help
.DEFAULT_GOAL := help
PLUGIN_NAME=PostNLShopware
PLUGIN_VERSION=`php -r 'echo json_decode(file_get_contents("$(PLUGIN_NAME)/composer.json"))->version;'`
RELEASE_DIR=/var/www/html/.plugins/
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# ------------------------------------------------------------------------------------------------------------
install: ## Installs all production dependencies
@composer install --no-dev
@{ [ -d src/Resources/app/administration ] && cd src/Resources/app/administration || exit 0; } && { [ -f package.json ] && npm install --production || exit 0; }
@{ [ -d src/Resources/app/storefront ] && cd src/Resources/app/storefront || exit 0; } && { [ -f package.json ] && npm install --production || exit 0; }
dev: ## Installs all dev dependencies
@composer install
@{ [ -d src/Resources/app/administration ] && cd src/Resources/app/administration || exit 0; } && { [ -f package.json ] && npm install || exit 0; }
@{ [ -d src/Resources/app/storefront ] && cd src/Resources/app/storefront || exit 0; } && { [ -f package.json ] && npm install || exit 0; }
clean: ## Cleans all dependencies
rm -rf vendor
rm -rf .reports | true
@make clean-node
clean-node: ## Removes node_modules
rm -rf src/Resources/app/administration/node_modules
rm -rf src/Resources/app/storefront/node_modules
# ------------------------------------------------------------------------------------------------------------
insights: ## Starts the PHPInsights Analyser
@php vendor/bin/phpinsights analyse --no-interaction
csfix: ## Starts the PHP CS Fixer
@php vendor/bin/php-cs-fixer fix --config=./.php_cs.php --dry-run
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.4 ./src
phpstan: ## Starts the PHPStan Analyser
@php vendor/bin/phpstan analyse -c ./.phpstan.neon
@php vendor/bin/phpstan analyse -c ./.phpstan.lvl8.neon
phpunit: ## Starts all Unit Tests
@XDEBUG_MODE=coverage php vendor/bin/phpunit --configuration=phpunit.xml
infection: ## Starts all Infection/Mutation tests
@XDEBUG_MODE=coverage php vendor/bin/infection --configuration=./.infection.json
infection-covered: ## Starts covered Infection/Mutation tests
@XDEBUG_MODE=coverage php vendor/bin/infection --configuration=./.infection.json --only-covered
snippet-check: ## Tests and verifies all plugin snippets
@php vendor/bin/phpunuhi validate --report-format=junit --report-output=./.reports/phpunuhi/junit.xml
snippet-export: ## Exports all snippets
@php vendor/bin/phpunuhi export --dir=./.reports/phpunuhi
snippet-import: ## Imports the provided snippet set [set=xyz file=xz.csv]
@php vendor/bin/phpunuhi import --set=$(set) --file=$(file) --intent=1
# ------------------------------------------------------------------------------------------------------------
pr: ## Prepares everything for a Pull Request
@make dev
@make csfix
@make phpcheck -B
@make phpmin -B
@make phpstan -B
@make snippet-check -B
build: ## Builds the package
@rm -rf src/Resources/app/storefront/dist
@mkdir -p src/Resources/app/storefront/dist
@cd ../../.. && php bin/console plugin:refresh
@cd ../../.. && php bin/console plugin:install $(PLUGIN_NAME) --activate --clearCache | true
@cd ../../.. && php bin/console plugin:refresh
@cd ../../.. && php bin/console theme:dump
@cd ../../.. && php bin/console theme:refresh
@cd ../../.. && PUPPETEER_SKIP_DOWNLOAD=1 ./bin/build-js.sh
@cd ../../.. && php bin/console theme:refresh
release: ## Create a new release
@make clean
@make install
@make build
@make zip
@make copy-release
zip: ## Creates a new ZIP package
@php update-composer-require.php --shopware="~6.6.0" --env=prod --admin --storefront
@cd .. && echo "Creating Zip file $(PLUGIN_NAME)-$(PLUGIN_VERSION).zip\n"
@cd .. && rm -rf $(PLUGIN_NAME)-$(PLUGIN_VERSION).zip
@cd .. && zip -qq -r -0 $(PLUGIN_NAME)-$(PLUGIN_VERSION).zip $(PLUGIN_NAME)/ -x@$(PLUGIN_NAME)/zip.exclude.lst
@php update-composer-require.php --shopware="~6.6.0" --env=dev --admin --storefront
copy-release: ## Copies it to the releases directory
@mkdir -p $(RELEASE_DIR)$(PLUGIN_NAME)
@cd .. && cp -f $(PLUGIN_NAME)-$(PLUGIN_VERSION).zip $(RELEASE_DIR)$(PLUGIN_NAME)/$(PLUGIN_NAME)-$(PLUGIN_VERSION).zip