From bd5bb647b297ce63f458bd960873510ea5e61bb4 Mon Sep 17 00:00:00 2001 From: Andreas Weyer Date: Thu, 8 Jan 2026 16:57:18 +0000 Subject: [PATCH] Update deploy scripts to work with Vite dist dir (vs. build dir) --- scripts/build-and-deploy.sh | 9 +++++++++ scripts/deploy.ps1 | 6 +++--- scripts/deploy.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100755 scripts/build-and-deploy.sh create mode 100755 scripts/deploy.sh diff --git a/scripts/build-and-deploy.sh b/scripts/build-and-deploy.sh new file mode 100755 index 0000000..42def30 --- /dev/null +++ b/scripts/build-and-deploy.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" + +cd "${REPO_ROOT}" + +npm run build && bash "${SCRIPT_DIR}/deploy.sh" diff --git a/scripts/deploy.ps1 b/scripts/deploy.ps1 index ae6c476..b3a5962 100644 --- a/scripts/deploy.ps1 +++ b/scripts/deploy.ps1 @@ -2,10 +2,10 @@ $remoteHost = "11001001.org" # $remotePort = 22 $remoteDir = "/var/www/med-plan-assistant" -$localBuild = Join-Path $PSScriptRoot "..\build" +$localDist = Join-Path $PSScriptRoot "..\dist" # Using pscp (PuTTY) with Pageant: -# & "C:\Program Files\PuTTY\pscp.exe" -r -P $remotePort $localBuild\* ` +# & "C:\Program Files\PuTTY\pscp.exe" -r -P $remotePort $localDist\* ` # "$remoteUser@${remoteHost}:$remoteDir" # Example SSH config entry: @@ -15,5 +15,5 @@ $localBuild = Join-Path $PSScriptRoot "..\build" # Port 22 # Using pscp (PuTTY) with Pageant and ssh config: -& "C:\Program Files\PuTTY\pscp.exe" -r $localBuild\* ` +& "C:\Program Files\PuTTY\pscp.exe" -r $localDist\* ` "${remoteHost}:$remoteDir" diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..46a1f51 --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -euo pipefail + +# remoteUser="username" +remoteHost="11001001.org" +# remotePort=22 +remoteDir="/var/www/med-plan-assistant" + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +localDist="${SCRIPT_DIR}/../dist" + +if [[ ! -d "${localDist}" ]]; then + echo "Dist folder not found: ${localDist}" >&2 + exit 1 +fi + +dest="${remoteHost}:${remoteDir}" +if [[ -n "${remoteUser:-}" ]]; then + dest="${remoteUser}@${remoteHost}:${remoteDir}" +fi + +scp_args=() +if [[ -n "${remotePort:-}" ]]; then + scp_args+=("-P" "${remotePort}") +fi + +# Copy contents of dist directory to remote target +scp -r "${scp_args[@]}" "${localDist}/"* "${dest}"