Last active
September 17, 2024 15:47
-
-
Save Khant-Nyar/bd717617a32d94dcec57229e6fcf7030 to your computer and use it in GitHub Desktop.
pre-commit to run pint for laravel. bash cmd for auto run pint on git commit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --local core.hooksPath .git/hooks && echo '#!/bin/sh | |
./vendor/bin/pint' > .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Run Pint for code formatting | |
./vendor/bin/pint | |
# Ask if user wants to run tests | |
read -p "Do you want to run unit tests? (y/n): " run_tests | |
if [[ $run_tests == "y" ]]; then | |
# Ask which test framework to use | |
read -p "Choose test framework (1 for PHPUnit, 2 for Pest): " test_framework | |
case $test_framework in | |
1) | |
./vendor/bin/phpunit | |
;; | |
2) | |
./vendor/bin/pest | |
;; | |
*) | |
echo "Invalid choice. Skipping tests." | |
;; | |
esac | |
else | |
echo "Skipping tests." | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Run Pint for code formatting | |
./vendor/bin/pint | |
# Ask if user wants to run tests | |
read -p "Do you want to run unit tests? (y/n): " run_tests | |
if [[ $run_tests == "y" ]]; then | |
# Ask which test framework to use | |
read -p "Choose test framework (1 for PHPUnit, 2 for Pest): " test_framework | |
case $test_framework in | |
1) | |
./vendor/bin/phpunit | |
;; | |
2) | |
./vendor/bin/pest | |
;; | |
*) | |
echo "Invalid choice. Skipping tests." | |
;; | |
esac | |
else | |
echo "Skipping tests." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment