chore(deploy): server script to reset main, npm ci, build, rsync dist
- Hard reset to origin/main so local package edits cannot block pulls - Optional rsync to SITE_ROOT (default /var/www/iliadobkin.com) if dir exists - engines.node >=20.19, .nvmrc 22 for Vite 7 Made-with: Cursor
This commit is contained in:
parent
2558951568
commit
b523b67587
@ -3,6 +3,9 @@
|
||||
"description": "Create an automatic portfolio based on GitHub profile",
|
||||
"version": "4.0.0",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">=20.19.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "arifszn",
|
||||
"repository": {
|
||||
@ -19,7 +22,8 @@
|
||||
"lint:fix": "eslint . --fix --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"prettier": "prettier --check \"./**/*.{js,jsx,ts,tsx,css,md,json}\"",
|
||||
"prettier:fix": "prettier --write \"./**/*.{js,jsx,ts,tsx,css,md,json}\"",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"deploy:site": "bash scripts/deploy-site.sh"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^19.1.0",
|
||||
|
||||
36
scripts/deploy-site.sh
Normal file
36
scripts/deploy-site.sh
Normal file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run on the production host from the repo clone (e.g. /var/www/iliadobkin.com-src).
|
||||
# Fixes stuck deploys: local edits to package.json / lockfile block git pull — this resets to origin/main.
|
||||
#
|
||||
# Requires Node >= 20.19 (see .nvmrc). Example: nvm install && nvm use
|
||||
#
|
||||
# Optional: SITE_ROOT=/var/www/iliadobkin.com (default). Rsync runs only if that directory exists.
|
||||
|
||||
set -euo pipefail
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
SITE_ROOT="${SITE_ROOT:-/var/www/iliadobkin.com}"
|
||||
|
||||
echo "==> Node $(node -v) (Vite 7 needs 20.19+ or 22.12+)"
|
||||
|
||||
echo "==> Git: match origin/main exactly (drops local changes to tracked files)"
|
||||
git fetch origin
|
||||
git checkout main
|
||||
git reset --hard origin/main
|
||||
|
||||
echo "==> Dependencies (clean)"
|
||||
rm -rf node_modules
|
||||
npm ci
|
||||
|
||||
echo "==> Build"
|
||||
npm run build
|
||||
|
||||
if [[ -d "$SITE_ROOT" ]]; then
|
||||
echo "==> Publish dist/ -> $SITE_ROOT/"
|
||||
rsync -av --delete "${REPO_ROOT}/dist/" "${SITE_ROOT}/"
|
||||
echo "==> Done. Reload nginx if needed: systemctl reload nginx"
|
||||
else
|
||||
echo "WARN: SITE_ROOT '$SITE_ROOT' is not a directory — not copying dist."
|
||||
echo " Set SITE_ROOT to your nginx root, or copy ${REPO_ROOT}/dist/ manually."
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user