diff --git a/scripts/deploy-nas.cjs b/scripts/deploy-nas.cjs index 6694e29..3a4d1af 100644 --- a/scripts/deploy-nas.cjs +++ b/scripts/deploy-nas.cjs @@ -67,16 +67,23 @@ if (isWin) { } const portOpt = cleanPort ? `-p ${cleanPort}` : ""; - // -e 인자는 단따옴표로 감싸야 -i 경로의 공백/따옴표 충돌을 방지 - const sshCmd = `ssh ${portOpt} -i ${keyFile} -o StrictHostKeyChecking=accept-new -o BatchMode=yes` + // Synology는 rsync --server 모드를 별도 인증으로 막음 → tar | ssh 방식 사용 + const sshBase = `ssh ${portOpt} -i ${keyFile} -o StrictHostKeyChecking=accept-new -o PreferredAuthentications=publickey` .replace(/\s+/g, " ").trim(); - console.log(`Deploying via SSH → ${cleanTarget}:${cleanPath}`); - console.log(`SSH command: ${sshCmd}`); + console.log(`Deploying via tar|ssh → ${cleanTarget}:${cleanPath}`); + + // 1단계: 원격 디렉토리 초기화 execSync( - `rsync -r --delete --delete-delay -e '${sshCmd}' ${src}/ ${cleanTarget}:${cleanPath}`, + `${sshBase} ${cleanTarget} "rm -rf '${cleanPath}'/* 2>/dev/null; mkdir -p '${cleanPath}'"`, { stdio: "inherit" } ); + // 2단계: 빌드 산출물 tar로 전송 → 원격에서 압축 해제 + execSync( + `cd ${src} && tar czf - . | ${sshBase} ${cleanTarget} "cd '${cleanPath}' && tar xzf -"`, + { stdio: "inherit" } + ); + console.log("Deploy complete."); process.exit(0); }