From dad25f40c6e44da24767d707d1c5a6a76ad88bdc Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Mon, 28 Sep 2026 10:06:40 +0800 Subject: [PATCH] =?UTF-8?q?chore(deploy):=20=E7=A7=BB=E9=99=A4=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E8=84=9A=E6=9C=AC=E5=B9=B6=E5=8A=A0=E5=85=A5=E5=BF=BD?= =?UTF-8?q?=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 部署脚本改为本地文件,不纳入版本库 --- .gitignore | 4 ++++ deploy.mjs | 31 ------------------------------- 2 files changed, 4 insertions(+), 31 deletions(-) delete mode 100644 deploy.mjs diff --git a/.gitignore b/.gitignore index bbf3776f..bda38629 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,7 @@ yarn.lock # Local history .history + +# 本地部署脚本(含服务器地址与账号) +deploy.mjs +deploy.config.mjs diff --git a/deploy.mjs b/deploy.mjs deleted file mode 100644 index 255fc53e..00000000 --- a/deploy.mjs +++ /dev/null @@ -1,31 +0,0 @@ -/* eslint-disable no-console */ -/** - * 部署管理后台到服务器 | 用法:pnpm run deploy - * - * 前置:SSH 免密登录(只需一次) - * 1. 如果 %USERPROFILE%\.ssh\id_rsa 已存在跳过,否则 ssh-keygen -t rsa 回车到底 - * - * 2. 拷贝公钥到服务器(会提示输一次服务器密码): - * Windows: type %USERPROFILE%\.ssh\id_rsa.pub | ssh root@server "cat >> ~/.ssh/authorized_keys" - * Mac: ssh-copy-id root@server - * - * 3. ssh root@server 输完不弹密码直接连上即成功 - */ -import { execSync } from "node:child_process"; - -const HOST = "www.youlai.tech"; // 服务器 IP,改为你的 -const USER = "root"; // SSH 用户名,改为你的 -const PORT = 1010; // SSH 端口,改为你的 -const TARGET = "/mnt/nginx/html/vue"; // 部署目录,改为你的 -// ========================================================= - -console.log("构建中..."); -execSync("pnpm build-only", { stdio: "inherit" }); - -console.log(`部署 → ${USER}@${HOST}:${TARGET}`); -execSync(`scp -o StrictHostKeyChecking=no -P ${PORT} -r "dist/." "${USER}@${HOST}:${TARGET}/"`, { - stdio: "inherit", - shell: true, -}); - -console.log("部署完成");