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.
This commit is contained in:
2026-05-18 20:55:14 +03:00
parent 48662442a4
commit 7d48ec3f78
3 changed files with 35 additions and 14 deletions

View File

@@ -1,34 +1,31 @@
# Default deploy destination
deploy_dir := "/var/www/tietokonepaja-fi"
# Start development server # Start development server
dev: dev:
npm run dev bun run dev
# Build for production (with type-check and .htaccess copy) # Build for production (with type-check and .htaccess copy)
build: build:
npm run build bun run build
# Preview production build locally # Preview production build locally
preview: preview:
npm run preview bun run preview
# Build without type-checking # Build without type-checking
build-only *args: build-only *args:
npm run build-only -- {{args}} bun run build-only -- {{args}}
# Type-check with vue-tsc # Type-check with vue-tsc
type-check: type-check:
npm run type-check bun run type-check
# Lint and auto-fix # Lint and auto-fix
lint: lint:
npm run lint bun run lint
# Format source files with Prettier # Format source files with Prettier
format: format:
npm run format bun run format
# Build and deploy dist to the given directory (default: /var/www/tietokonepaja-fi) # Deploy using the deploy script
deploy dest=deploy_dir: build deploy:
cp -r dist/. {{dest}} bash scripts/deploy.sh

View File

@@ -4,7 +4,7 @@
"private": true, "private": true,
"type": "module", "type": "module",
"engines": { "engines": {
"node": "^20.19.0 || >=22.12.0" "bun": ">=1.0.0"
}, },
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

24
scripts/deploy.sh Executable file
View File

@@ -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."