From ec22321d56525599483c1022f53bf955388f0c2d Mon Sep 17 00:00:00 2001 From: gahusb Date: Sun, 10 May 2026 19:02:49 +0900 Subject: [PATCH] =?UTF-8?q?fix(deploy):=20NAS=5FFRONTEND=5FDEST=5FWIN=20en?= =?UTF-8?q?v=EB=A1=9C=20Z:=20=EB=A7=A4=ED=95=91=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EB=8C=80=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/deploy-nas.cjs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/deploy-nas.cjs b/scripts/deploy-nas.cjs index 3a4d1af..9f57620 100644 --- a/scripts/deploy-nas.cjs +++ b/scripts/deploy-nas.cjs @@ -20,8 +20,11 @@ if (fs.existsSync(envLocalPath)) { const isWin = process.platform === "win32"; const isMac = process.platform === "darwin"; const src = "dist"; -const dstWin = "Z:\\docker\\webpage\\frontend\\"; -const dstMac = "/Volumes/gahusb.synology.me/docker/webpage/frontend/"; +// Windows 배포 경로 — Z: 매핑이 NAS 루트(/volume1/)인 경우 docker\webpage\frontend, +// /volume1/docker/만 매핑된 경우 webpage\frontend, /volume1/docker/webpage 매핑이면 frontend. +// NAS_FRONTEND_DEST_WIN env로 override (예: "Z:\\webpage\\frontend\\") +const dstWin = process.env.NAS_FRONTEND_DEST_WIN || "Z:\\docker\\webpage\\frontend\\"; +const dstMac = process.env.NAS_FRONTEND_DEST_MAC || "/Volumes/gahusb.synology.me/docker/webpage/frontend/"; const dst = isWin ? dstWin : dstMac; if (!fs.existsSync(src)) { @@ -30,8 +33,10 @@ if (!fs.existsSync(src)) { } if (isWin) { + // dstWin을 PowerShell 문자열로 안전하게 escape + const dstPs = dstWin.replace(/\\/g, "\\\\"); const cmd = - 'powershell -NoProfile -ExecutionPolicy Bypass -Command "$ErrorActionPreference=\\"Stop\\"; $src=\\"dist\\"; $dst=\\"Z:\\\\docker\\\\webpage\\\\frontend\\\\\\"; if(!(Test-Path $src)){ throw \\"dist not found. Run build first.\\" }; if(!(Test-Path $dst)){ throw \\"NAS drive not found. Check Z: mapping.\\" }; $log = Join-Path (Get-Location) \\"robocopy.log\\"; robocopy $src $dst /MIR /R:1 /W:1 /E /NFL /NDL /NP /V /TEE /LOG:$log; $rc = $LASTEXITCODE; if($rc -ge 8){ Write-Host \\"robocopy failed with code $rc. See $log\\"; exit $rc } else { exit 0 }"'; + `powershell -NoProfile -ExecutionPolicy Bypass -Command "$ErrorActionPreference=\\"Stop\\"; $src=\\"dist\\"; $dst=\\"${dstPs}\\"; if(!(Test-Path $src)){ throw \\"dist not found. Run build first.\\" }; if(!(Test-Path $dst)){ throw \\"NAS 경로를 찾을 수 없음: $dst — Z: 매핑 또는 NAS_FRONTEND_DEST_WIN env 확인\\" }; $log = Join-Path (Get-Location) \\"robocopy.log\\"; robocopy $src $dst /MIR /R:1 /W:1 /E /NFL /NDL /NP /V /TEE /LOG:$log; $rc = $LASTEXITCODE; if($rc -ge 8){ Write-Host \\"robocopy failed with code $rc. See $log\\"; exit $rc } else { exit 0 }"`; execSync(cmd, { stdio: "inherit" }); } else if (isMac) { const sshTarget = process.env.NAS_SSH_TARGET;