Git hooks to improve laravel development and deployment process
In order to optimize asset for production automnatically, pre-commit hook can be useful.
This pre-commit hook will look for any file change in resource directory and run yarn production
.
To set up this hook, enter command bellow in terminal
curl -fsSL https://raw.githubusercontent.com/HazzazBinFaiz/laravel-git-hooks/main/pre-commit > .git/hooks/pre-commit
In order to update package and optimize laravel app, post-receive hook can be useful. This post-receive hook will look for any change in file named composer and install new packages and it will optimize laravel app by running php artisan optimize.
To set up shared hook, enter command bellow in terminal
Warning: Use with your own risk
curl -fsSL https://raw.githubusercontent.com/HazzazBinFaiz/laravel-git-hooks/main/post-receive-shared > .git/hooks/post-receive
To set up this hook, enter command bellow in terminal
curl -fsSL https://raw.githubusercontent.com/HazzazBinFaiz/laravel-git-hooks/main/post-receive > .git/hooks/post-receive
This is not a hook setup, just a helpful script to setup laravel app
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/HazzazBinFaiz/laravel-git-hooks/main/initial_setup.sh)"
export PHP=/usr/local/bin/other-php && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/HazzazBinFaiz/laravel-git-hooks/main/initial_setup.sh)"
export COMPOSER_BIN=/usr/local/bin/composer && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/HazzazBinFaiz/laravel-git-hooks/main/initial_setup.sh)"