웹 디자인 전면 개편
This commit is contained in:
@@ -17,9 +17,9 @@ const dstMac = `/Volumes/gahusb.synology.me/docker/webpage/${projectName}/`;
|
||||
const dst = isWin ? dstWin : dstMac;
|
||||
|
||||
// SSH 설정 (환경 변수에서 읽기)
|
||||
const sshTarget = process.env.NAS_SSH_TARGET || "gahusb@gahusb.synology.me";
|
||||
const sshTarget = process.env.NAS_SSH_TARGET || "bgg8988@192.168.45.54";
|
||||
const sshPath = process.env.NAS_SSH_PATH || `/volume1/docker/webpage/${projectName}`;
|
||||
const sshPort = process.env.NAS_SSH_PORT;
|
||||
const sshPort = process.env.NAS_SSH_PORT || "2300";
|
||||
|
||||
// 제외할 파일/폴더
|
||||
const excludePatterns = [
|
||||
@@ -56,9 +56,59 @@ if (process.env.NAS_DEPLOY_METHOD === "ssh" || sshTarget) {
|
||||
try {
|
||||
// 1. rsync로 파일 동기화
|
||||
console.log("📦 Step 1: Syncing files to NAS...");
|
||||
const rsyncCmd = `rsync -avz --delete ${excludeArgs} -e "${sshCmd}" ${projectRoot}/ ${sshTarget}:${sshPath}/`;
|
||||
|
||||
// Windows에서 rsync 찾기 (Git Bash 또는 WSL)
|
||||
let rsyncPath = "rsync";
|
||||
let sourcePath = projectRoot;
|
||||
|
||||
if (isWin) {
|
||||
// Git Bash에서 실행 중이면 rsync를 바로 사용 가능
|
||||
try {
|
||||
execSync("rsync --version", { stdio: "ignore" });
|
||||
rsyncPath = "rsync";
|
||||
console.log("✅ Using rsync from Git Bash");
|
||||
} catch (err) {
|
||||
// Git Bash가 아니면 rsync.exe 찾기
|
||||
const possiblePaths = [
|
||||
"C:\\Program Files\\Git\\usr\\bin\\rsync.exe",
|
||||
"C:\\Program Files (x86)\\Git\\usr\\bin\\rsync.exe",
|
||||
process.env.PROGRAMFILES + "\\Git\\usr\\bin\\rsync.exe",
|
||||
process.env.LOCALAPPDATA + "\\Programs\\Git\\usr\\bin\\rsync.exe",
|
||||
];
|
||||
|
||||
for (const testPath of possiblePaths) {
|
||||
if (fs.existsSync(testPath)) {
|
||||
rsyncPath = testPath;
|
||||
console.log(`✅ Found rsync at: ${testPath}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// rsync를 못 찾으면 에러 메시지
|
||||
if (rsyncPath === "rsync") {
|
||||
console.error("❌ rsync not found on Windows");
|
||||
console.log("");
|
||||
console.log("💡 Debug: Let's find rsync");
|
||||
console.log(" Run this in Git Bash: which rsync");
|
||||
console.log("");
|
||||
console.log(" Then update the script with the correct path.");
|
||||
console.log("");
|
||||
console.log(" Or use SMB mount deployment:");
|
||||
console.log(" npm run release:nas");
|
||||
console.log("");
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Windows 경로를 Git Bash 스타일로 변환 (C:\... -> /c/...)
|
||||
sourcePath = projectRoot
|
||||
.replace(/\\/g, "/")
|
||||
.replace(/^([A-Z]):/, (match, drive) => `/${drive.toLowerCase()}`);
|
||||
}
|
||||
|
||||
const rsyncCmd = `"${rsyncPath}" -avz --delete ${excludeArgs} -e "${sshCmd}" "${sourcePath}/" ${sshTarget}:${sshPath}/`;
|
||||
console.log(`Command: ${rsyncCmd}`);
|
||||
execSync(rsyncCmd, { stdio: "inherit" });
|
||||
execSync(rsyncCmd, { stdio: "inherit", shell: true });
|
||||
console.log("✅ Files synced successfully");
|
||||
console.log("");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user