From 3785e0dc665053e0d2bc341bdf42694de169e0ed Mon Sep 17 00:00:00 2001 From: GoodM4ven Date: Wed, 18 Oct 2023 09:26:39 +0300 Subject: [PATCH] v2.5.0 - Added the ability to raw-create projects without a single modification - Added SQlite installation during setup script - Updated [./README.md] - Added motion to be installed to front-end packages - Fixed fonts preloading issue --- README.md | 8 +- .../resources/views/components/app.blade.php | 4 +- .../views/components/localized-app.blade.php | 8 +- lara-stacker.sh | 12 +- scripts/create.sh | 4 +- scripts/create_raw.sh | 147 ++++++++++++++++++ scripts/setup.sh | 4 +- 7 files changed, 173 insertions(+), 14 deletions(-) create mode 100755 scripts/create_raw.sh diff --git a/README.md b/README.md index cc90d05..ab2a88f 100755 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ This way, I don't have to worry about the things I've mentioned, plus I gain the - [php](https://www.php.net/) - [apache2](https://httpd.apache.org/) - [composer](https://getcomposer.org/) + - [sqlite3](https://www.sqlite.org/index.html) - [libnss3-tools](https://packages.ubuntu.com/focal/libnss3-tools) - [libgbm-dev](https://packages.debian.org/sid/libgbm-dev) - [libnotify-dev](https://packages.debian.org/sid/libnotify-dev) @@ -122,16 +123,17 @@ This way, I don't have to worry about the things I've mentioned, plus I gain the - [Graphite](https://graphite.dev/) - Essentials + - [tippy.js](https://atomiks.github.io/tippyjs/) - [laravel-wave](https://github.com/qruto/laravel-wave) + - [@formkit/auto-animate](https://github.com/formkit/auto-animate) + - [motion](https://github.com/motiondivision/motionone) + - [@tailwindcss/container-queries](https://github.com/tailwindlabs/tailwindcss-container-queries) - [tailwindcss](https://tailwindcss.com/) [Dev] - [postcss](https://github.com/postcss/postcss) [Dev] - [autoprefixer](https://github.com/postcss/autoprefixer) [Dev] - - [@formkit/auto-animate](https://github.com/formkit/auto-animate) [Dev] - [@tailwindcss/typography](https://tailwindcss.com/docs/typography-plugin) [Dev] - [@tailwindcss/forms](https://github.com/tailwindlabs/tailwindcss-forms) [Dev] - [@tailwindcss/aspect-ratio](https://github.com/tailwindlabs/tailwindcss-aspect-ratio) [Dev] - - [@tailwindcss/container-queries](https://github.com/tailwindlabs/tailwindcss-container-queries) [Dev] - - [tippy.js](https://atomiks.github.io/tippyjs/) [Dev] - [Option] TALL Stack - [alpinejs](https://alpinejs.dev/) (Already included in Livewire now!) - [@alpinejs/mask](https://alpinejs.dev/plugins/mask) diff --git a/files/_stubs/tall/resources/views/components/app.blade.php b/files/_stubs/tall/resources/views/components/app.blade.php index aaf2f8e..d26c8e0 100755 --- a/files/_stubs/tall/resources/views/components/app.blade.php +++ b/files/_stubs/tall/resources/views/components/app.blade.php @@ -76,7 +76,9 @@ class="h-full min-h-screen w-full antialiased" > @stack('fonts') diff --git a/files/_stubs/tall/resources/views/components/localized-app.blade.php b/files/_stubs/tall/resources/views/components/localized-app.blade.php index 2edf725..c3b8248 100755 --- a/files/_stubs/tall/resources/views/components/localized-app.blade.php +++ b/files/_stubs/tall/resources/views/components/localized-app.blade.php @@ -78,11 +78,15 @@ class="h-full min-h-screen w-full antialiased" > @stack('fonts') diff --git a/lara-stacker.sh b/lara-stacker.sh index 2c73a80..4d5cc6b 100755 --- a/lara-stacker.sh +++ b/lara-stacker.sh @@ -52,6 +52,7 @@ SCRIPTS=( "./scripts/setup.sh" "./scripts/list.sh" "./scripts/create.sh" + "./scripts/create_raw.sh" "./scripts/delete.sh" "./scripts/update.sh" "./scripts/helpers/permit.sh" @@ -120,7 +121,7 @@ while true; do echo -e "Available Operations:\n" - options=("1. List Projects" "2. Create Project" "3. Delete Project" "4. Exit") + options=("1. List Projects" "2. Create Project" "3. Create Raw Project" "4. Delete Project" "5. Exit") # Conditional options if [[ -f "/tmp/updated-lara-stacker.flag" ]]; then @@ -128,7 +129,7 @@ while true; do update_available=false fi if [ "$update_available" == true ]; then - options+=("5. Download Updates") + options+=("6. Download Updates") fi if [[ ! -f "$lara_stacker_dir/done-setup.flag" ]]; then options+=("0. Initial Setup") @@ -164,13 +165,16 @@ while true; do sudo RAN_MAIN_SCRIPT="true" ./scripts/create.sh ;; 3) - sudo RAN_MAIN_SCRIPT="true" ./scripts/delete.sh + sudo RAN_MAIN_SCRIPT="true" ./scripts/create_raw.sh ;; 4) + sudo RAN_MAIN_SCRIPT="true" ./scripts/delete.sh + ;; + 5) echo -e "\nExiting Lara-Stacker...\n" exit 0 ;; - 5) + 6) if [ "$update_available" == false ]; then prompt "-=|[ Lara-Stacker [$current_version] ]|=-" "Invalid option! Please type one the of digits in the list..." false false else diff --git a/scripts/create.sh b/scripts/create.sh index 02758a0..99b688b 100755 --- a/scripts/create.sh +++ b/scripts/create.sh @@ -372,9 +372,9 @@ fi # Packages... if $cancel_suppression; then - $BUN add @tailwindcss/container-queries tippy.js laravel-wave @formkit/auto-animate 2>&1 + $BUN add @tailwindcss/container-queries tippy.js laravel-wave @formkit/auto-animate motion 2>&1 else - $BUN add @tailwindcss/container-queries tippy.js laravel-wave @formkit/auto-animate 2>&1 >/dev/null + $BUN add @tailwindcss/container-queries tippy.js laravel-wave @formkit/auto-animate motion 2>&1 >/dev/null fi # Enforce permissions diff --git a/scripts/create_raw.sh b/scripts/create_raw.sh new file mode 100755 index 0000000..8a72c52 --- /dev/null +++ b/scripts/create_raw.sh @@ -0,0 +1,147 @@ +#!/bin/bash + +clear + +# Status indicator +echo -e "-=|[ Lara-Stacker |> CREATE RAW ]|=-\n" + +# * =========== +# * Validation +# * ========= + +# Check if prompt function exists and source it +function_path="./scripts/functions/prompt.sh" +if [[ ! -f $function_path ]]; then + echo -e "Error: Working directory isn't the script's main.\n" + + echo -e "Tip: Maybe run [cd ~/Downloads/lara-stacker/ && sudo ./lara-stacker.sh] commands.\n" + + echo -n "Press any key to exit..." + read whatever + + clear + exit 1 +fi +source $function_path + +# Ensure the script isn't ran directly +if [[ -z "$RAN_MAIN_SCRIPT" ]]; then + prompt "Aborted for direct execution flow." "Please use the main [lara-stacker.sh] script." true false +fi + +# Confirm if setup script isn't run +if [ ! -e "$PWD/done-setup.flag" ]; then + echo -n "Setup script isn't run yet. Are you sure you want to continue? (y/n) " + read confirmation + + case "$confirmation" in + n|N|no|No|NO|nope|Nope|NOPE) + echo -e "\nAborting...\n" + + echo -n "Press any key to continue..." + read whatever + + clear + exit 1 + ;; + esac +fi + +# * ============ +# * Preparation +# * ========== + +# Get environment variables and defaults +lara_stacker_dir=$PWD +source $lara_stacker_dir/.env + +# Setting the echoing level +conditional_quiet="--quiet" +cancel_suppression=false +case $LOGGING_LEVEL in +# Notifications Only +1) + exec 3>&1 + exec > /dev/null 2>&1 + ;; +# Notifications + Errors + Warnings +2) + exec 3>&1 + exec > /dev/null + ;; +# Everything +*) + exec 3>&1 + conditional_quiet="" + cancel_suppression=true + ;; +esac + +# * ================= +# * Collecting Input +# * =============== + +# Get the project path from the user +echo -ne "Enter the full project path (e.g., /home/$USERNAME/Code/my_project): " >&3 +read full_directory + +full_directory="${full_directory%/}" +project_path=$(dirname "$full_directory") +project_name=$(basename "$full_directory") + +# Cancel if the project path directory doesn't exists +if [ ! -d "$project_path" ]; then + prompt "\nThe project containing path doesn't exist!" "Raw project creation cancelled." +fi + +# Cancel if the project directory already exists +if [ -d "$project_path/$project_name" ]; then + prompt "\nProject folder already exist within the previously given path!" "Raw project creation cancelled." +fi + +# * ================= +# * Project Creation +# * =============== + +# Create the Laravel raw project in the provided path and folder +echo -e "\nInstalling the project via Composer..." >&3 + +cd $project_path/ +composer create-project --prefer-dist laravel/laravel $project_name -n $conditional_quiet + +# Enforce permissions +sudo $lara_stacker_dir/scripts/helpers/permit.sh $project_path/$project_name + +cd $project_path/$project_name + +sed -i "s/APP_NAME=Laravel/APP_NAME=\"$project_name\"/g" ./.env + +echo -e "\nCreated and named the raw Laravel application." >&3 + +# Set up launch.json for debugging (Xdebug) +mkdir $project_path/$project_name/.vscode +cd $project_path/$project_name/.vscode + +sudo cp $lara_stacker_dir/files/.vscode/launch.json ./ + +sed -i "s~\[projectsDirectory\]~$project_path~g" ./launch.json +sed -i "s~\[projectName\]~$project_name~g" ./launch.json + +echo -e "\nConfigured VSC debug settings for Xdebug support." >&3 + +# * ======== +# * The End +# * ====== + +# Enforce permissions +sudo $lara_stacker_dir/scripts/helpers/permit.sh $project_path/$project_name + +echo -e "\nUpdated directory and file permissions all around." >&3 + +# Display a success message +echo -e "\nRaw project created successfully! Run [art serve] from within its directory for launch.\n" >&3 + +echo -n "Press any key to continue..." >&3 +read whatever + +clear >&3 diff --git a/scripts/setup.sh b/scripts/setup.sh index e9d891c..5a08233 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -85,9 +85,9 @@ esac echo -e "Installing system packages..." >&3 if $cancel_suppression; then - sudo apt install git curl php apache2 php-curl php-xml php-dom php-bcmath php-zip redis-server npm -y 2>&1 + sudo apt install git curl php apache2 php-curl php-xml php-dom php-bcmath php-zip sqlite3 redis-server npm -y 2>&1 else - sudo apt install git curl php apache2 php-curl php-xml php-dom php-bcmath php-zip redis-server npm -y 2>&1 >/dev/null + sudo apt install git curl php apache2 php-curl php-xml php-dom php-bcmath php-zip sqlite3 redis-server npm -y 2>&1 >/dev/null fi sudo sed -i "s~post_max_size = 8M~post_max_size = 100M~g" /etc/php/8.1/apache2/php.ini