bun run deploy / bun push

This commit is contained in:
Chris Wanstrath 2025-09-16 20:32:27 -07:00
parent ffd4e6e4a1
commit 77f545a262
2 changed files with 26 additions and 1 deletions

View File

@ -5,7 +5,9 @@
"private": true, "private": true,
"scripts": { "scripts": {
"start": "bun src/server.tsx", "start": "bun src/server.tsx",
"dev": "env BUN_HOT=1 bun --hot src/server.tsx" "dev": "env BUN_HOT=1 bun --hot src/server.tsx",
"deploy": "./scripts/deploy.sh",
"push": "./scripts/deploy.sh"
}, },
"alias": { "alias": {
"@utils": "./src/utils.tsx", "@utils": "./src/utils.tsx",

23
scripts/deploy.sh Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
HOST="chris@nose-pluto.local"
DEST="~/pluto"
SOCK="$HOME/.ssh/cm-%r@%h:%p"
# 1) Open a master connection (prompts once)
ssh -MNf -o ControlMaster=yes -o ControlPersist=120 \
-o ControlPath="$SOCK" "$HOST"
# 2) rsync (reuses the connection)
rsync -az --delete \
-e "ssh -o ControlPath=$SOCK" \
--exclude 'node_modules/' \
--exclude '.git/' \
./ "$HOST:$DEST/"
# 3) remote install (reuses the connection)
ssh -o ControlPath="$SOCK" "$HOST" "cd $DEST && bun install --frozen-lockfile"
# 4) close the master connection
ssh -O exit -o ControlPath="$SOCK" "$HOST"