lotto lab API 정리
- API 스펙 정리 문서 업로드 - 스펙 다운로드 기능 추가 나스 배포 오류 수정
This commit is contained in:
27
scripts/deploy-nas.cjs
Normal file
27
scripts/deploy-nas.cjs
Normal file
@@ -0,0 +1,27 @@
|
||||
const { execSync } = require("child_process");
|
||||
const fs = require("fs");
|
||||
|
||||
const isWin = process.platform === "win32";
|
||||
const src = "dist";
|
||||
const dstWin = "Z:\\docker\\webpage\\frontend\\";
|
||||
const dstMac = "/Volumes/gahusb.synology.me/docker/webpage/frontend/";
|
||||
const dst = isWin ? dstWin : dstMac;
|
||||
|
||||
if (!fs.existsSync(src)) {
|
||||
console.error("dist not found. Run build first.");
|
||||
process.exit(1);
|
||||
}
|
||||
if (!fs.existsSync(dst)) {
|
||||
console.error("NAS path not found. Check mount: " + dst);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (isWin) {
|
||||
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 }"';
|
||||
execSync(cmd, { stdio: "inherit" });
|
||||
} else {
|
||||
execSync(`rsync -av --delete --delete-delay --inplace ${src}/ ${dst}`, {
|
||||
stdio: "inherit",
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user