Skip to content

Instantly share code, notes, and snippets.

@quantumwebco
Last active September 1, 2024 10:23
Show Gist options
  • Save quantumwebco/3981576410c99263b3a7975a831c915b to your computer and use it in GitHub Desktop.
Save quantumwebco/3981576410c99263b3a7975a831c915b to your computer and use it in GitHub Desktop.
Bash script to prepare a Laravel Sail app for deployment
#!/bin/bash
Help() {
echo "Prepare the app for deployment."
echo "This script will run Pint, generate Ziggy routes, and then run Prettier, before adding all changed files for committing."
echo
echo "Syntax: prepare [pint|ziggy|pretier|h|help]"
echo "options:"
echo "pint Format PHP files with Pint."
echo "ziggy Generate Ziggy routes."
echo "prettier Format front end files with Prettier."
echo "h|help Print this Help."
echo
}
Prettier() {
echo "Running Prettier"
./vendor/bin/sail yarn prettier --write "resources/**/*.{js,vue}"
echo ""
}
Pint() {
echo "Running Pint"
./vendor/bin/sail pint
echo ""
}
Ziggy() {
echo "Generating routes with Ziggy"
./vendor/bin/sail artisan ziggy:generate --types
echo ""
}
for arg in "$*"
do
case $arg in
h|help|\?)
Help
exit;;
pint)
Pint;;
ziggy)
Ziggy;;
prettier)
Prettier;;
esac
done
if [ -z "$1" ]
then
Pint
Ziggy
Prettier
fi
git add .
git status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment