@rpcbase/cli 0.185.0 → 0.186.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.185.0",
3
+ "version": "0.186.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -31,18 +31,18 @@ const getInstanceDeployDir = (baseDeployDir, instance) => `${baseDeployDir}-${in
31
31
  const sleep = async (ms) => new Promise((resolve) => setTimeout(resolve, ms))
32
32
 
33
33
  const sharedInfrastructureIncludePatterns = [
34
- "infrastructure/compose.yml",
35
- "infrastructure/compose.instances.yml",
36
- "infrastructure/package.json",
37
- "infrastructure/package-lock.json",
38
- "infrastructure/ensure-*",
39
- "infrastructure/mongot/***",
40
- ".env",
41
- ".env.*",
34
+ "/infrastructure/compose.yml",
35
+ "/infrastructure/compose.instances.yml",
36
+ "/infrastructure/package.json",
37
+ "/infrastructure/package-lock.json",
38
+ "/infrastructure/ensure-*",
39
+ "/infrastructure/mongot/***",
40
+ "/.env",
41
+ "/.env.*",
42
42
  ]
43
43
 
44
44
  const sharedInfrastructureExcludePatterns = [
45
- "infrastructure/data/***",
45
+ "/infrastructure/data/***",
46
46
  ]
47
47
 
48
48
  const toArray = (value) => {
@@ -382,17 +382,18 @@ export const deploy = async (argv) => {
382
382
  ? sharedInfrastructureExcludePatterns.concat(deployExcludePatterns)
383
383
  : deployExcludePatterns,
384
384
  includePatterns: useBlueGreen
385
- ? sharedInfrastructureIncludePatterns.concat(preparedDeploy.sharedEnvFileNames)
385
+ ? sharedInfrastructureIncludePatterns.concat(preparedDeploy.sharedEnvFileNames.map((name) => `/${name}`))
386
386
  : undefined,
387
387
  })
388
388
 
389
389
  if (infrastructureChanged) {
390
390
  if (useBlueGreen) {
391
391
  if (argv.verbose) console.log(infrastructureDiff)
392
- throw new Error("Shared infrastructure files changed. Deploy or restart the shared infrastructure explicitly before running a blue/green app deploy.")
392
+ console.log("Shared infrastructure files changed; refreshing shared infrastructure before deploying the inactive app instance.")
393
+ } else {
394
+ console.log("Infrastructure compose files differ between local and remote (info only; deploy proceeds).")
395
+ if (argv.verbose) console.log(infrastructureDiff)
393
396
  }
394
- console.log("Infrastructure compose files differ between local and remote (info only; deploy proceeds).")
395
- if (argv.verbose) console.log(infrastructureDiff)
396
397
  }
397
398
  }
398
399
 
@@ -416,6 +417,8 @@ export const deploy = async (argv) => {
416
417
  log(`Running: ${infrastructureRsyncCmd}`)
417
418
  execSync(infrastructureRsyncCmd, { stdio: argv.verbose ? "inherit" : "ignore" })
418
419
  await ssh(`cd ~/apps/${baseDeployDir}/infrastructure && [ -f package.json ] && npm ci || true`)
420
+ console.log("Refreshing shared infrastructure before deploying the inactive app instance.")
421
+ await ssh(`cd ~/apps/${baseDeployDir}/infrastructure && for f in ensure-*.js; do [ -f "$f" ] || continue; node "$f"; done && node ctrl.js up-infra prod`, true)
419
422
  }
420
423
 
421
424
  const excludeList = baseExcludeList