@rpcbase/cli 0.121.0 → 0.123.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -66,9 +66,22 @@ const buildRsyncCmd = ({ includeArgs, excludeArgs, keyPath, source, dest, remote
|
|
|
66
66
|
return parts.join(" ")
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
const runRsync = (cmd) => {
|
|
70
|
+
try {
|
|
71
|
+
execSync(cmd, { stdio: "ignore" })
|
|
72
|
+
} catch (err) {
|
|
73
|
+
const allowed = [23, 24]
|
|
74
|
+
if (!allowed.includes(err?.status)) throw err
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Pull remote compose files into a temp dir, mirror local ones into another, then hash trees to detect diffs.
|
|
79
|
+
// Callers await this check; errors bubble up except for benign rsync statuses handled in runRsync.
|
|
80
|
+
export const detectComposeChanges = async ({ keyPath, user, host, deployDir, log, extraExcludes = [] }) => {
|
|
70
81
|
const includeArgs = ["--include='*/'", "--include='*compose*.yml'", "--exclude='*'"]
|
|
71
82
|
const excludeArgs = baseExcludeList
|
|
83
|
+
// dev compose files are not relevant for prod deploy checks
|
|
84
|
+
.concat(["compose.dev.yml"])
|
|
72
85
|
.concat(extraExcludes)
|
|
73
86
|
.map((p) => `--exclude='${p}'`)
|
|
74
87
|
.join(" ")
|
|
@@ -88,7 +101,6 @@ export const detectComposeChanges = ({ keyPath, user, host, deployDir, log, extr
|
|
|
88
101
|
}
|
|
89
102
|
|
|
90
103
|
try {
|
|
91
|
-
// fetch remote compose files into temp dir
|
|
92
104
|
const remoteSyncCmd = buildRsyncCmd({
|
|
93
105
|
includeArgs,
|
|
94
106
|
excludeArgs,
|
|
@@ -97,10 +109,9 @@ export const detectComposeChanges = ({ keyPath, user, host, deployDir, log, extr
|
|
|
97
109
|
dest: `${remoteDir}/`,
|
|
98
110
|
remote: true,
|
|
99
111
|
})
|
|
100
|
-
log(`Syncing remote compose files: ${remoteSyncCmd}`)
|
|
101
|
-
|
|
112
|
+
log?.(`Syncing remote compose files: ${remoteSyncCmd}`)
|
|
113
|
+
runRsync(remoteSyncCmd)
|
|
102
114
|
|
|
103
|
-
// copy local compose files into temp dir (same filters to keep parity)
|
|
104
115
|
const localSyncCmd = buildRsyncCmd({
|
|
105
116
|
includeArgs,
|
|
106
117
|
excludeArgs,
|
|
@@ -109,8 +120,8 @@ export const detectComposeChanges = ({ keyPath, user, host, deployDir, log, extr
|
|
|
109
120
|
dest: `${localDir}/`,
|
|
110
121
|
remote: false,
|
|
111
122
|
})
|
|
112
|
-
log(`Syncing local compose files: ${localSyncCmd}`)
|
|
113
|
-
|
|
123
|
+
log?.(`Syncing local compose files: ${localSyncCmd}`)
|
|
124
|
+
runRsync(localSyncCmd)
|
|
114
125
|
|
|
115
126
|
const remoteHashes = hashTree(remoteDir)
|
|
116
127
|
const localHashes = hashTree(localDir)
|
package/src/cmd-deploy/index.js
CHANGED
|
@@ -88,7 +88,7 @@ export const deploy = async (argv) => {
|
|
|
88
88
|
console.log(`${user}@${host}`, res)
|
|
89
89
|
await ssh(`mkdir -p ~/apps/${deployDir}`)
|
|
90
90
|
|
|
91
|
-
const { hasChanges: infrastructureChanged, output: infrastructureDiff } = detectComposeChanges({
|
|
91
|
+
const { hasChanges: infrastructureChanged, output: infrastructureDiff } = await detectComposeChanges({
|
|
92
92
|
keyPath,
|
|
93
93
|
user,
|
|
94
94
|
host,
|