deploy:nas macOS에서 오류 수정
This commit is contained in:
@@ -2,6 +2,7 @@ const { execSync } = require("child_process");
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
const isWin = process.platform === "win32";
|
const isWin = process.platform === "win32";
|
||||||
|
const isMac = process.platform === "darwin";
|
||||||
const src = "dist";
|
const src = "dist";
|
||||||
const dstWin = "Z:\\docker\\webpage\\frontend\\";
|
const dstWin = "Z:\\docker\\webpage\\frontend\\";
|
||||||
const dstMac = "/Volumes/gahusb.synology.me/docker/webpage/frontend/";
|
const dstMac = "/Volumes/gahusb.synology.me/docker/webpage/frontend/";
|
||||||
@@ -21,7 +22,15 @@ if (isWin) {
|
|||||||
'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=\\"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" });
|
execSync(cmd, { stdio: "inherit" });
|
||||||
} else {
|
} else {
|
||||||
execSync(`rsync -av --delete --delete-delay --inplace ${src}/ ${dst}`, {
|
const baseArgs = ["rsync", "-r", "--delete", "--delete-delay"];
|
||||||
stdio: "inherit",
|
const macSafeArgs = [
|
||||||
});
|
"--omit-dir-times",
|
||||||
|
"--no-perms",
|
||||||
|
"--no-owner",
|
||||||
|
"--no-group",
|
||||||
|
"--no-times",
|
||||||
|
];
|
||||||
|
const args = isMac ? baseArgs.concat(macSafeArgs) : baseArgs.concat(["-t"]);
|
||||||
|
const cmd = `${args.join(" ")} ${src}/ ${dst}`;
|
||||||
|
execSync(cmd, { stdio: "inherit" });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user