chore(deploy): 重置默认服务器配置并格式化代码

This commit is contained in:
Ray.Hao
2026-06-18 18:41:34 +08:00
parent 14035cfa4d
commit 892d89b98c

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-console */
/**
* 部署管理后台到服务器 | 用法pnpm run deploy
*
@@ -13,19 +12,22 @@
*/
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"; // 部署目录,改为你的
// ==================== 改为你的服务器信息 ====================
const HOST = "127.0.0.1"; // 服务器 IP,改为你的
const USER = "root"; // SSH 用户名,改为你的
const PORT = 22; // SSH 端口,改为你的
const TARGET = "/data/www/vue3-element-admin"; // 部署目录,改为你的
// =========================================================
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,
});
execSync(
`scp -o StrictHostKeyChecking=no -P ${PORT} -r "dist/." "${USER}@${HOST}:${TARGET}/"`,
{ stdio: "inherit", shell: true }
);
console.log("部署完成");