From b3d71c21c4a7005c0ac0332aff3b37f48628caa0 Mon Sep 17 00:00:00 2001
From: Jan Wennrich <jan.wennrich@pcsg.de>
Date: Fri, 24 May 2024 16:56:26 +0200
Subject: [PATCH] chore: add developer scripts to composer.json

---
 composer.json | 114 ++++++++++++++++++++++++++++++++++----------------
 1 file changed, 78 insertions(+), 36 deletions(-)

diff --git a/composer.json b/composer.json
index 0c52007..5689cd4 100644
--- a/composer.json
+++ b/composer.json
@@ -1,38 +1,80 @@
 {
-  "name": "quiqqer/template-cologne",
-  "type": "quiqqer-template",
-  "description": "The QUIQQER Cologne E-Commerce Template",
-  "license": "GPLv3",
-  "authors": [
-    {
-      "name": "Henning Leutz",
-      "email": "support@pcsg.de",
-      "homepage": "https://www.pcsg.de",
-      "role": "Developer"
+    "name": "quiqqer/template-cologne",
+    "type": "quiqqer-template",
+    "description": "The QUIQQER Cologne E-Commerce Template",
+    "license": "GPLv3",
+    "authors": [
+        {
+            "name": "Henning Leutz",
+            "email": "support@pcsg.de",
+            "homepage": "https://www.pcsg.de",
+            "role": "Developer"
+        }
+    ],
+    "support": {
+        "email": "support@pcsg.de",
+        "url": "https://www.pcsg.de"
+    },
+    "require": {
+        "php": "^8.1",
+        "quiqqer/core": "^2",
+        "quiqqer/erp": "^3",
+        "quiqqer/products": "^2",
+        "quiqqer/order": "^2",
+        "quiqqer/product-bricks": "^2",
+        "quiqqer/frontend-users": "^2",
+        "quiqqer/menu": "^3",
+        "quiqqer/sitetypes": "^2",
+        "quiqqer/unsemantic": "^2",
+        "quiqqer-asset/fastclick": "^1",
+        "quiqqer/tooltips": "^2",
+        "quiqqer/currency": "^2"
+    },
+    "autoload": {
+        "psr-4": {
+            "QUI\\TemplateCologne\\": "src/QUI/TemplateCologne"
+        }
+    },
+    "scripts": {
+        "test": [
+            "@dev:lint",
+            "@dev:phpunit"
+        ],
+        "dev:phpunit": "./tools/phpunit",
+        "dev:lint": [
+            "@dev:lint:phpstan",
+            "@dev:lint:style"
+        ],
+        "dev:lint:phpstan": "./tools/phpstan",
+        "dev:lint:style": "./tools/phpcs",
+        "dev:lint:style:fix": "./tools/phpcbf",
+        "dev:init": [
+            "@dev:init:check-requirements",
+            "@dev:init:tools",
+            "@dev:init:git-hooks"
+        ],
+        "dev:init:check-requirements": [
+            "which composer > /dev/null || (echo 'Error: composer has to be globally installed'; exit 1)",
+            "which phive > /dev/null || (echo 'Error: PHIVE has to be globally installed'; exit 1)"
+        ],
+        "dev:init:tools": "phive install --temporary",
+        "dev:init:git-hooks": "./tools/captainhook install --only-enabled --force"
+    },
+    "scripts-aliases": {
+        "test": [
+            "dev:test"
+        ]
+    },
+    "scripts-descriptions": {
+        "test": "Runs linting, static analysis, and unit tests.",
+        "dev:phpunit": "Run PHPUnit test suites",
+        "dev:lint": "Run PHPStan and code style check",
+        "dev:lint:phpstan": "Run PHPStan",
+        "dev:lint:style": "Run code style check (PHP_CodeSniffer)",
+        "dev:lint:style:fix": "Try to fix code style errors automatically",
+        "dev:init": "Initialize the developer tooling (tools and git hooks)",
+        "dev:init:check-requirements": "Check if the necessary requirements are met",
+        "dev:init:tools": "Install all developer tools (requires PHIVE)",
+        "dev:init:git-hooks": "Install all git hooks (may require tools to be installed)"
     }
-  ],
-  "support": {
-    "email": "support@pcsg.de",
-    "url": "https://www.pcsg.de"
-  },
-  "require": {
-    "php": "^8.1",
-    "quiqqer/core": "^2",
-    "quiqqer/erp": "^3",
-    "quiqqer/products": "^2",
-    "quiqqer/order": "^2",
-    "quiqqer/product-bricks": "^2",
-    "quiqqer/frontend-users": "^2",
-    "quiqqer/menu": "^3",
-    "quiqqer/sitetypes": "^2",
-    "quiqqer/unsemantic": "^2",
-    "quiqqer-asset/fastclick": "^1",
-    "quiqqer/tooltips": "^2",
-    "quiqqer/currency": "^2"
-  },
-  "autoload": {
-    "psr-4": {
-      "QUI\\TemplateCologne\\": "src/QUI/TemplateCologne"
-    }
-  }
-}
+}
\ No newline at end of file
-- 
GitLab