From e3adc9a29a29c6294d9b2a5bdaf81c6b009a55cc Mon Sep 17 00:00:00 2001 From: Zack Spear Date: Wed, 8 May 2024 12:49:09 -0700 Subject: [PATCH] chore: dev deployment script improvements --- plugin/scripts/deploy-dev.sh | 24 ++++++++++++++++++++++++ web/scripts/deploy-dev.sh | 10 +++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/plugin/scripts/deploy-dev.sh b/plugin/scripts/deploy-dev.sh index d5882df69..bd855aea7 100755 --- a/plugin/scripts/deploy-dev.sh +++ b/plugin/scripts/deploy-dev.sh @@ -1,5 +1,9 @@ #!/bin/bash +# Arguments +# $1: SSH server name +# $2: --wc-deploy / deploy web components w/o prompt + # Path to store the last used server name state_file="$HOME/.deploy_state" @@ -38,6 +42,26 @@ echo "$rsync_command" eval "$rsync_command" exit_code=$? +# if $2 is --wc-deploy, deploy the web components without prompting +if [ "$2" = "--wc-deploy" ]; then + deploy="yes" +fi + +# if not deploy yes then ask +if [ -z "$deploy" ]; then + echo + echo + read -rp -e "Do you want to also deploy the built web components? (yes/no/build): " deploy +fi + +if [ "$deploy" = "yes" ]; then + cd web || exit + npm run deploy-wc:dev +elif [ "$deploy" = "build" ]; then + cd web || exit + npm run build:dev +fi + # Play built-in sound based on the operating system if [[ "$OSTYPE" == "darwin"* ]]; then # macOS diff --git a/web/scripts/deploy-dev.sh b/web/scripts/deploy-dev.sh index a967ed6a3..d8f863b1f 100755 --- a/web/scripts/deploy-dev.sh +++ b/web/scripts/deploy-dev.sh @@ -22,8 +22,16 @@ fi # Save the current server name to the state file echo "$server_name" > "$state_file" +# Source directory path +source_directory=".nuxt/nuxt-custom-elements/dist/unraid-components" + +if [ ! -d "$source_directory" ]; then + echo "The web components directory does not exist." + exit 1 +fi + # Replace the value inside the rsync command with the user's input -rsync_command="rsync -avz -e ssh .nuxt/nuxt-custom-elements/dist/unraid-components root@${server_name}:/usr/local/emhttp/plugins/dynamix.my.servers" +rsync_command="rsync -avz -e ssh $source_directory root@${server_name}:/usr/local/emhttp/plugins/dynamix.my.servers" echo "Executing the following command:" echo "$rsync_command"