Last active
December 15, 2022 02:37
-
-
Save jrson83/fbfa7ef1ff358aee57e7537c6e5c35e7 to your computer and use it in GitHub Desktop.
idea laravel install.sh
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
#!/bin/bash | |
RED="\e[41m" | |
GREEN="\e[42m" | |
BLUE="\e[44m" | |
CYAN="\e[36m" | |
MAGENTA="\e[45m" | |
ENDCOLOR="\e[0m" | |
### | |
# config | |
### | |
fw=$1 | |
frameworks=("preact" "react" "vue") | |
app="sandbox" | |
### | |
# no arguments specified | |
### | |
if [[ -z $1 ]]; then | |
read -p "Please choose a UI Framework $(echo -e "$CYAN""preact|react|vue""$ENDCOLOR"): " fw | |
fi | |
### | |
# wrong framework specified | |
### | |
if [[ ! " ${frameworks[@]} " =~ " ${fw} " ]]; then | |
echo -e "${RED} FAIL ${ENDCOLOR} Please specify a UI Framework: ${CYAN}preact|react|vue${ENDCOLOR}" | |
exit 1 | |
fi | |
### | |
# dir exists | |
### | |
if [ -d "${app}-${fw}" ]; then | |
echo -e "${MAGENTA} WARN ${ENDCOLOR} Dir <${app}-${fw}> already exists!" | |
exit 1 | |
fi | |
### | |
# check enviroments | |
### | |
echo -e "${BLUE} INFO ${ENDCOLOR} Checking your enviroments...\n" | |
php=$(which php) | |
composer=$(which composer) | |
git=$(which git) | |
if [[ ! -e $php ]] ; then | |
echo -e "${RED} FAIL ${ENDCOLOR} PHP was not found, please install PHP first" | |
exit 1 | |
elif [[ ! -e $composer ]] ; then | |
echo -e "${RED} FAIL ${ENDCOLOR} Composer was not found, please install composer first" | |
echo "More information can be found at http://getcomposer.org/" | |
exit 1 | |
elif [[ ! -e $git ]] ; then | |
echo -e "${RED} FAIL ${ENDCOLOR} Git was not found, please install git first" | |
exit 1 | |
else | |
echo -e "${GREEN} DONE ${ENDCOLOR} Requirements are satisfied!\n" | |
fi | |
### | |
# install laravel dependencies | |
### | |
echo -e "${BLUE} INFO ${ENDCOLOR} Installing laravel dependencies...\n" | |
# composer create-project laravel/laravel "${app}"-"${fw}" | |
# mkdir "${PWD}"/"${app}"-"${fw}" | |
cd "${PWD}"/"${app}"-"${fw}" || exit | |
php artisan storage:link | |
echo -e "${GREEN} DONE ${ENDCOLOR} Laravel dependencies installed!\n" | |
### | |
# install framework preset | |
### | |
echo -e "${BLUE} INFO ${ENDCOLOR} Installing framework dependencies...\n" | |
npx @preset/cli apply ourAppName:"${fw}" | |
### | |
# done | |
### | |
echo -e "${GREEN} ALL DONE ${ENDCOLOR}\n" | |
echo -e "To start development run ${CYAN}pnpm dev:${fw}${ENDCOLOR}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment