Skip to content

Commit cfb5a1e

Browse files
committed
fix(Composer): standarize commands
1 parent 4f908cd commit cfb5a1e

4 files changed

Lines changed: 235 additions & 243 deletions

File tree

Makefile

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ else
2626
RESET := ""
2727
endif
2828

29+
#---
30+
31+
RANDOM_ORDER_SEED := $(shell head -200 /dev/urandom | cksum | cut -f1 -d " ")
32+
33+
#---
2934

3035
###
3136
# HELP
@@ -68,77 +73,74 @@ endef
6873
###
6974

7075
.PHONY: composer-dump
71-
composer-dump: ## Application: <composer dump-auto>
76+
composer-dump: ## [COMPOSER] Executes <composer dump-auto> inside the container
7277
$(DOCKER_RUN_AS_USER) composer dump-auto --ansi --no-plugins --profile --classmap-authoritative --apcu --strict-psr
7378
$(call taskDone)
7479

7580
.PHONY: composer-install
76-
composer-install: ## Application: <composer install>
81+
composer-install: ## [COMPOSER] Executes <composer install> inside the container
7782
$(DOCKER_RUN_AS_USER) composer install --ansi --no-plugins --classmap-authoritative --audit --apcu-autoloader
7883
$(call taskDone)
7984

8085
.PHONY: composer-remove
81-
composer-remove: require-package ## Application: <composer remove>
86+
composer-remove: require-package ## [COMPOSER] Executes <composer remove> inside the container
8287
$(DOCKER_RUN_AS_USER) composer remove --ansi --no-plugins --classmap-authoritative --apcu-autoloader --with-all-dependencies --unused
8388
$(call taskDone)
8489

8590
.PHONY: composer-require-dev
86-
composer-require-dev: ## Application: <composer require --dev>
91+
composer-require-dev: ## [COMPOSER] Executes <composer require --dev> inside the container
8792
$(DOCKER_RUN_AS_USER) composer require --ansi --no-plugins --classmap-authoritative --apcu-autoloader --with-all-dependencies --prefer-stable --sort-packages --dev
8893
$(call taskDone)
8994

9095
.PHONY: composer-require
91-
composer-require: ## Application: <composer require>
96+
composer-require: ## [COMPOSER] Executes <composer require> inside the container
9297
$(DOCKER_RUN_AS_USER) composer require --ansi --no-plugins --classmap-authoritative --apcu-autoloader --with-all-dependencies --prefer-stable --sort-packages
9398
$(call taskDone)
9499

95100
.PHONY: composer-update
96-
composer-update: ## Application: <composer update>
101+
composer-update: ## [COMPOSER] Executes <composer update> inside the container
97102
$(DOCKER_RUN_AS_USER) composer update --ansi --no-plugins --classmap-authoritative --apcu-autoloader --with-all-dependencies
98103
$(call taskDone)
99104

100105
###
101106
# QA
102107
###
103108

104-
.PHONY: linter
105-
linter: ## QA: <composer linter>
109+
.PHONY: check-syntax
110+
check-syntax: ## [QA] Executes <check-syntax [filter=app]> inside the container
106111
@$(eval filter ?= 'app')
107-
@composer linter $(filter)
112+
@vendor/bin/parallel-lint --colors -e php -j 10 $(filter)
108113
$(call taskDone)
109114

110-
.PHONY: phpcs
111-
phpcs: ## QA: <composer phpcbs>
115+
.PHONY: check-style
116+
check-style: ## [QA] Executes <check-style [filter=app]> inside the container
112117
@$(eval filter ?= 'app')
113-
@composer phpcs $(filter)
118+
@vendor/bin/phpcs -p --colors --standard=phpcs.xml $(filter)
114119
$(call taskDone)
115120

116-
.PHONY: phpcbf
117-
phpcbf: ## QA: <composer phpcbf>
121+
.PHONY: fix-style
122+
fix-style: ## [QA] Executes <fix-style [filter=app]> inside the container
118123
@$(eval filter ?= 'app')
119-
@composer phpcbf $(filter)
124+
@vendor/bin/phpcbf -p --colors --standard=phpcs.xml $(filter)
120125
$(call taskDone)
121126

122127
.PHONY: phpstan
123-
phpstan: ## QA: <composer phpstan>
128+
phpstan: ## [QA] Executes <phpstan [filter=app]> inside the container
124129
@$(eval filter ?= 'app')
125-
@composer phpstan $(filter)
130+
@vendor/bin/phpstan analyse --ansi --memory-limit=1G --no-progress --configuration=phpstan.neon $(filter)
126131
$(call taskDone)
127132

128133
.PHONY: tests
129-
tests: ## QA: <composer tests>
134+
tests: ## [QA] Executes <phpunit --testsuite=[testsuite=Unit] --filter=[filter=.]> inside the container
130135
@$(eval testsuite ?= 'Unit')
131136
@$(eval filter ?= '.')
132-
@composer tests --testsuite=$(testsuite) --filter=$(filter)
133-
$(call taskDone)
134-
135-
.PHONY: tests-unit
136-
tests-unit: ## QA: <composer tests-unit>
137-
@$(eval filter ?= '.')
138-
@composer tests-unit --filter=$(filter)
137+
@vendor/bin/phpunit --testsuite=$(testsuite) --filter=$(filter) --configuration=phpunit.xml --coverage-text --testdox --colors --order-by=random --random-order-seed=$(RANDOM_ORDER_SEED)
139138
$(call taskDone)
140139

141140
.PHONY: coverage
142-
coverage: ## QA: <composer coverage>
143-
@composer coverage
141+
coverage: ## [QA] Executes <phpunit --coverage-html=[folder=./coverage]> inside the container
142+
@$(eval folder ?= './coverage')
143+
@rm -Rf $(folder) || true
144+
@mkdir $(folder)
145+
@vendor/bin/phpunit --coverage-html=$(folder) --configuration=phpunit.xml --coverage-text --testdox --colors --order-by=random --random-order-seed=$(RANDOM_ORDER_SEED)
144146
$(call taskDone)

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,18 @@ Additionally a *Makefile* is provided with frequently used commands:
9292
║ ║
9393
╚══════════════════════════════════════════════════════════════════════════════╝
9494

95-
· composer-dump Application: <composer dump-auto>
96-
· composer-install Application: <composer install>
97-
· composer-remove Application: <composer remove>
98-
· composer-require-dev Application: <composer require --dev>
99-
· composer-require Application: <composer require>
100-
· composer-update Application: <composer update>
101-
· linter QA: <composer linter>
102-
· phpcs QA: <composer phpcbs>
103-
· phpcbf QA: <composer phpcbf>
104-
· phpstan QA: <composer phpstan>
105-
· tests QA: <composer tests>
106-
· tests-unit QA: <composer tests-unit>
107-
· coverage QA: <composer coverage>
95+
· composer-dump [COMPOSER] Executes <composer dump-auto> inside the container
96+
· composer-install [COMPOSER] Executes <composer install> inside the container
97+
· composer-remove [COMPOSER] Executes <composer remove> inside the container
98+
· composer-require-dev [COMPOSER] Executes <composer require --dev> inside the container
99+
· composer-require [COMPOSER] Executes <composer require> inside the container
100+
· composer-update [COMPOSER] Executes <composer update> inside the container
101+
· check-syntax [QA] Executes <check-syntax [filter=app]> inside the container
102+
· check-style [QA] Executes <check-style [filter=app]> inside the container
103+
· fix-style [QA] Executes <fix-style [filter=app]> inside the container
104+
· phpstan [QA] Executes <phpstan [filter=app]> inside the container
105+
· tests [QA] Executes <phpunit --testsuite=[testsuite=Unit] --filter=[filter=.]> inside the container
106+
· coverage [QA] Executes <phpunit --coverage-html=[folder=./coverage]> inside the container
108107
```
109108

110109
##### Installing Dependencies

composer.json

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
"homepage": "https://alcidesrc.com/"
1212
}
1313
],
14+
"support": {
15+
"issues": "https://github.com/alcidesrc/php-skeleton/issues",
16+
"source": "https://github.com/alcidesrc/php-skeleton"
17+
},
18+
"require": {
19+
"php": "^8.3"
20+
},
1421
"autoload": {
1522
"psr-4": {
1623
"App\\": "app/"
@@ -40,29 +47,11 @@
4047
"symfony/var-dumper": "^7.0"
4148
},
4249
"scripts": {
43-
"linter": "vendor/bin/parallel-lint --colors -e php -j 10",
44-
"phpcs": "vendor/bin/phpcs -p --colors --standard=phpcs.xml",
45-
"phpcbf": "vendor/bin/phpcbf -p --colors --standard=phpcs.xml",
50+
"check-syntax": "vendor/bin/parallel-lint --colors -e php -j 10",
51+
"check-style": "vendor/bin/phpcs -p --colors --standard=phpcs.xml",
52+
"fix-style": "vendor/bin/phpcbf -p --colors --standard=phpcs.xml",
4653
"phpstan": "vendor/bin/phpstan analyse --ansi --memory-limit=1G --no-progress --configuration=phpstan.neon",
47-
"phpunit": "vendor/bin/phpunit --configuration=phpunit.xml --testdox --colors --order-by=random --random-order-seed=$(head -200 /dev/urandom | cksum | cut -f1 -d \" \")",
48-
49-
"tests": [
50-
"@linter app/ tests/",
51-
"@phpcs",
52-
"@phpunit --coverage-text"
53-
],
54-
"tests-unit": [
55-
"@linter app/ tests/",
56-
"@phpcs",
57-
"@phpunit --coverage-text --testsuite=Unit"
58-
],
59-
60-
"coverage": [
61-
"rm -Rf /coverage/*",
62-
"@linter app/ tests/",
63-
"@phpcs",
64-
"@phpunit --coverage-text --coverage-html=/coverage"
65-
]
54+
"tests": "vendor/bin/phpunit --configuration=phpunit.xml --coverage-text --testdox --colors --order-by=random --random-order-seed=$(head -200 /dev/urandom | cksum | cut -f1 -d \" \")"
6655
},
6756
"minimum-stability": "stable",
6857
"prefer-stable": true

0 commit comments

Comments
 (0)