From 90cfde2e6ec2b6772ad3c11a7126f84d0aa991f0 Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Tue, 11 Jun 2024 09:50:46 -0400 Subject: [PATCH] [dx] keep tooling in one place - `composer tools:run` runs `php-cs-fixer` & `phpstan` - `composer tools:run:php-cs-fixer` run only `php-cs-fixer` (works for `phpstan` as well). - `composer tools:upgrade` upgrades / installs all of the `tools/*` - `composer tools:upgrade:php-cs-fixer` Upgrades / installs only `php-cs-fixer` (works for `phpstan` as well) --- composer.json | 17 +++++++++++++++-- tools/.gitignore | 2 ++ tools/php-cs-fixer/composer.json | 5 +++++ tools/phpstan/composer.json | 5 +++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 tools/.gitignore create mode 100644 tools/php-cs-fixer/composer.json create mode 100644 tools/phpstan/composer.json diff --git a/composer.json b/composer.json index 5d42a79..7f4c26d 100644 --- a/composer.json +++ b/composer.json @@ -21,8 +21,7 @@ "require-dev": { "symfony/filesystem": "^6.3|^7.0", "symfony/framework-bundle": "^6.3|^7.0", - "symfony/phpunit-bridge": "^6.3|^7.0", - "phpstan/phpstan": "1.11.x-dev" + "symfony/phpunit-bridge": "^6.3|^7.0" }, "minimum-stability": "dev", "autoload": { @@ -34,5 +33,19 @@ "psr-4": { "Symfonycasts\\TailwindBundle\\Tests\\": "tests/" } + }, + "scripts": { + "tools:upgrade": [ + "@tools:upgrade:php-cs-fixer", + "@tools:upgrade:phpstan" + ], + "tools:upgrade:php-cs-fixer": "composer upgrade -W -d tools/php-cs-fixer", + "tools:upgrade:phpstan": "composer upgrade -W -d tools/phpstan", + "tools:run": [ + "@tools:run:php-cs-fixer", + "@tools:run:phpstan" + ], + "tools:run:php-cs-fixer": "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix", + "tools:run:phpstan": "tools/phpstan/vendor/bin/phpstan --memory-limit=1G" } } diff --git a/tools/.gitignore b/tools/.gitignore new file mode 100644 index 0000000..af5e68f --- /dev/null +++ b/tools/.gitignore @@ -0,0 +1,2 @@ +**/vendor +**/composer.lock diff --git a/tools/php-cs-fixer/composer.json b/tools/php-cs-fixer/composer.json new file mode 100644 index 0000000..2d76bbe --- /dev/null +++ b/tools/php-cs-fixer/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "friendsofphp/php-cs-fixer": "^3" + } +} diff --git a/tools/phpstan/composer.json b/tools/phpstan/composer.json new file mode 100644 index 0000000..f53376b --- /dev/null +++ b/tools/phpstan/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "phpstan/phpstan": "^1" + } +}