-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (42 loc) · 1.5 KB
/
Makefile
File metadata and controls
53 lines (42 loc) · 1.5 KB
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
COMMIT := $(shell git rev-parse --short=8 HEAD)
ZIP_FILENAME := $(or $(ZIP_FILENAME), $(shell echo "$${PWD\#\#*/}.zip"))
BUILD_DIR := $(or $(BUILD_DIR),"build")
VENDOR_AUTOLOAD := vendor/autoload.php
BASENAME := $(shell basename $(PWD))
ZIP_FILE := build/$(BASENAME).zip
ifeq ($(PROD)x, x)
COMPOSER_ARGS := --prefer-dist --no-progress
else
COMPOSER_ARGS := --no-dev
endif
.PHONY: help
help: ## Print the help documentation
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
$(ZIP_FILE): $(VENDOR_AUTOLOAD)
npm install
npm run build
git archive --format=zip --output=${ZIP_FILENAME} $(COMMIT)
zip -r ${ZIP_FILENAME} vendor/ -x "*.neon" -x "*.toml" -x "*.stub" -x "*.bat" -x "**/carbon" -x "**/phpcs" -x "**/phpcbf"
zip -r ${ZIP_FILENAME} assets/js/dist
mkdir ${BUILD_DIR} && mv ${ZIP_FILENAME} ${BUILD_DIR}/
.PHONY: build
build: $(ZIP_FILE) ## Build the release zip file
.PHONY: clean
clean: ## clean
rm -rf build dist
$(VENDOR_AUTOLOAD):
composer install $(COMPOSER_ARGS)
.PHONY: composer
composer: $(VENDOR_AUTOLOAD) ## Runs composer install
.PHONY: lint
lint: composer ## PHP Lint
vendor/squizlabs/php_codesniffer/bin/phpcs *.php
.PHONY: fmt
fmt: composer ## PHP Fmt
vendor/squizlabs/php_codesniffer/bin/phpcbf *.php
.PHONY: test
test: composer ## PHP Unit Test
vendor/bin/phpunit
.PHONY: coverage
coverage: composer ## PHP Unit Test with Coverage
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover coverage.xml