From 7d48ec3f785696423c1c3eaa8c951d9cfdd14884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veikko=20Lintuj=C3=A4rvi?= Date: Mon, 18 May 2026 20:55:14 +0300 Subject: [PATCH] Switch to bun and add deploy script Update engines in package.json to bun, switch all justfile recipes from npm to bun, add scripts/deploy.sh for production deployment. --- justfile | 23 ++++++++++------------- package.json | 2 +- scripts/deploy.sh | 24 ++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 14 deletions(-) create mode 100755 scripts/deploy.sh diff --git a/justfile b/justfile index 926b064..ef56d4e 100644 --- a/justfile +++ b/justfile @@ -1,34 +1,31 @@ -# Default deploy destination -deploy_dir := "/var/www/tietokonepaja-fi" - # Start development server dev: - npm run dev + bun run dev # Build for production (with type-check and .htaccess copy) build: - npm run build + bun run build # Preview production build locally preview: - npm run preview + bun run preview # Build without type-checking build-only *args: - npm run build-only -- {{args}} + bun run build-only -- {{args}} # Type-check with vue-tsc type-check: - npm run type-check + bun run type-check # Lint and auto-fix lint: - npm run lint + bun run lint # Format source files with Prettier format: - npm run format + bun run format -# Build and deploy dist to the given directory (default: /var/www/tietokonepaja-fi) -deploy dest=deploy_dir: build - cp -r dist/. {{dest}} +# Deploy using the deploy script +deploy: + bash scripts/deploy.sh diff --git a/package.json b/package.json index 04695a4..6e778ef 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "type": "module", "engines": { - "node": "^20.19.0 || >=22.12.0" + "bun": ">=1.0.0" }, "scripts": { "dev": "vite", diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..004a548 --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -e + +APP_NAME="tietokonepaja-fi" +APP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +DEPLOY_DIR="/var/www/tietokonepaja-fi" + +echo "Deploying $APP_NAME from $APP_DIR..." + +cd "$APP_DIR" + +echo "Pulling latest changes..." +sudo -E git pull + +echo "Installing dependencies..." +sudo bun install + +echo "Building application..." +sudo bun run build + +echo "Copying to $DEPLOY_DIR..." +sudo cp -r dist/. "$DEPLOY_DIR" + +echo "Deployment complete."