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

---
 composer.json | 104 +++++++++++++++++++++++++++++++++++---------------
 1 file changed, 73 insertions(+), 31 deletions(-)

diff --git a/composer.json b/composer.json
index d79bfa4..e78e118 100644
--- a/composer.json
+++ b/composer.json
@@ -1,34 +1,76 @@
 {
-  "name": "quiqqer\/interview",
-  "type": "quiqqer-plugin",
-  "description": "Extension for blog and news plugin. This plugin adds some new attributes and provides new bricks.",
-  "license": "GPL-3.0+",
-  "authors": [
-    {
-      "name": "Michael Danielczok",
-      "email": "michael@pcsg.de",
-      "homepage": "http:\/\/www.pcsg.de",
-      "role": "Developer"
+    "name": "quiqqer/interview",
+    "type": "quiqqer-plugin",
+    "description": "Extension for blog and news plugin. This plugin adds some new attributes and provides new bricks.",
+    "license": "GPL-3.0+",
+    "authors": [
+        {
+            "name": "Michael Danielczok",
+            "email": "michael@pcsg.de",
+            "homepage": "http://www.pcsg.de",
+            "role": "Developer"
+        },
+        {
+            "name": "Dominik Chrzanowski",
+            "email": "dominik.chrzanowski@gmail.com",
+            "role": "Developer"
+        }
+    ],
+    "support": {
+        "email": "support@pcsg.de"
     },
-    {
-      "name": "Dominik Chrzanowski",
-      "email": "dominik.chrzanowski@gmail.com",
-      "role": "Developer"
-    }
-  ],
-  "support": {
-    "email": "support@pcsg.de"
-  },
-  "require": {
-    "quiqqer\/quiqqer": ">=1.6|dev-master|dev-dev"
-  },
-  "suggest": {
-    "quiqqer\/blog": "Create your own online diary. With the provided page types, managing and creating your own blog is no longer a problem.",
-    "quiqqer\/news": "News functionality for the QUIQQER system."
-  },
-  "autoload": {
-    "psr-4": {
-      "QUI\\Interview\\": "src\/QUI\/Interview"
+    "require": {
+        "quiqqer/quiqqer": ">=1.6|dev-master|dev-dev"
+    },
+    "suggest": {
+        "quiqqer/blog": "Create your own online diary. With the provided page types, managing and creating your own blog is no longer a problem.",
+        "quiqqer/news": "News functionality for the QUIQQER system."
+    },
+    "autoload": {
+        "psr-4": {
+            "QUI\\Interview\\": "src/QUI/Interview"
+        }
+    },
+    "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)"
     }
-  }
-}
+}
\ No newline at end of file
-- 
GitLab