From fac4a8aaf9ec6029e98d027c42870a5e0ffef693 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 23 Sep 2024 20:45:42 +0200 Subject: [PATCH] hooks? --- composer.json | 6 +++++- hooks/pre-commit | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 hooks/pre-commit diff --git a/composer.json b/composer.json index e8b46105d..17432c532 100644 --- a/composer.json +++ b/composer.json @@ -84,7 +84,11 @@ "@php artisan vendor:publish --tag=laravel-assets --ansi --force", "Illuminate\\Foundation\\ComposerScripts::postUpdate" ], - "post-install-cmd": [], + "post-install-cmd": [ + "cp -r 'hooks/' '.git/hooks/'", + "php -r \"copy('hooks/pre-commit', '.git/hooks/pre-commit');\"", + "php -r \"chmod('.git/hooks/pre-commit', 0777);\"" + ], "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], diff --git a/hooks/pre-commit b/hooks/pre-commit new file mode 100644 index 000000000..f5fa60755 --- /dev/null +++ b/hooks/pre-commit @@ -0,0 +1,7 @@ +#!/bin/sh +# Detect whether /dev/tty is available & functional +if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then + exec < /dev/tty +fi + +$(pwd)/vendor/bin/pint