@rpcbase/cli 0.121.0 → 0.122.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/cli",
3
- "version": "0.121.0",
3
+ "version": "0.122.0",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -66,6 +66,17 @@ const buildRsyncCmd = ({ includeArgs, excludeArgs, keyPath, source, dest, remote
66
66
  return parts.join(" ")
67
67
  }
68
68
 
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
+ // This is informational only; callers should treat errors as non-blocking.
69
80
  export const detectComposeChanges = ({ keyPath, user, host, deployDir, log, extraExcludes = [] }) => {
70
81
  const includeArgs = ["--include='*/'", "--include='*compose*.yml'", "--exclude='*'"]
71
82
  const excludeArgs = baseExcludeList
@@ -88,7 +99,6 @@ export const detectComposeChanges = ({ keyPath, user, host, deployDir, log, extr
88
99
  }
89
100
 
90
101
  try {
91
- // fetch remote compose files into temp dir
92
102
  const remoteSyncCmd = buildRsyncCmd({
93
103
  includeArgs,
94
104
  excludeArgs,
@@ -97,10 +107,9 @@ export const detectComposeChanges = ({ keyPath, user, host, deployDir, log, extr
97
107
  dest: `${remoteDir}/`,
98
108
  remote: true,
99
109
  })
100
- log(`Syncing remote compose files: ${remoteSyncCmd}`)
101
- execSync(remoteSyncCmd, { stdio: "ignore" })
110
+ log?.(`Syncing remote compose files: ${remoteSyncCmd}`)
111
+ runRsync(remoteSyncCmd)
102
112
 
103
- // copy local compose files into temp dir (same filters to keep parity)
104
113
  const localSyncCmd = buildRsyncCmd({
105
114
  includeArgs,
106
115
  excludeArgs,
@@ -109,8 +118,8 @@ export const detectComposeChanges = ({ keyPath, user, host, deployDir, log, extr
109
118
  dest: `${localDir}/`,
110
119
  remote: false,
111
120
  })
112
- log(`Syncing local compose files: ${localSyncCmd}`)
113
- execSync(localSyncCmd, { stdio: "ignore" })
121
+ log?.(`Syncing local compose files: ${localSyncCmd}`)
122
+ runRsync(localSyncCmd)
114
123
 
115
124
  const remoteHashes = hashTree(remoteDir)
116
125
  const localHashes = hashTree(localDir)
@@ -88,14 +88,22 @@ 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({
92
- keyPath,
93
- user,
94
- host,
95
- deployDir,
96
- log,
97
- extraExcludes: argv.ignore || [],
98
- })
91
+ let infrastructureChanged = false
92
+ let infrastructureDiff = ""
93
+ try {
94
+ ({ hasChanges: infrastructureChanged, output: infrastructureDiff } = detectComposeChanges({
95
+ keyPath,
96
+ user,
97
+ host,
98
+ deployDir,
99
+ log,
100
+ extraExcludes: argv.ignore || [],
101
+ }))
102
+ } catch (diffError) {
103
+ console.warn(
104
+ `Compose diff check skipped (non-blocking): ${diffError instanceof Error ? diffError.message : diffError}`,
105
+ )
106
+ }
99
107
 
100
108
  if (infrastructureChanged) {
101
109
  console.log("Infrastructure compose files differ between local and remote (info only; deploy proceeds).")