@vaharoni/devops 1.1.11 → 1.2.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.
Files changed (167) hide show
  1. package/dist/cli/core/affected.d.ts +9 -0
  2. package/dist/cli/core/affected.d.ts.map +1 -0
  3. package/dist/cli/{affected.js → core/affected.js} +4 -6
  4. package/dist/cli/core/cloudrun.d.ts +9 -0
  5. package/dist/cli/core/cloudrun.d.ts.map +1 -0
  6. package/dist/cli/{cloudrun.js → core/cloudrun.js} +3 -5
  7. package/dist/cli/core/console.d.ts +9 -0
  8. package/dist/cli/core/console.d.ts.map +1 -0
  9. package/dist/cli/{console.js → core/console.js} +5 -7
  10. package/dist/cli/core/constant.d.ts +9 -0
  11. package/dist/cli/core/constant.d.ts.map +1 -0
  12. package/dist/cli/{constant.js → core/constant.js} +3 -5
  13. package/dist/cli/core/env.d.ts +9 -0
  14. package/dist/cli/core/env.d.ts.map +1 -0
  15. package/dist/cli/{env.js → core/env.js} +4 -6
  16. package/dist/cli/core/exec.d.ts +9 -0
  17. package/dist/cli/core/exec.d.ts.map +1 -0
  18. package/dist/cli/{exec.js → core/exec.js} +5 -7
  19. package/dist/cli/core/image.d.ts +9 -0
  20. package/dist/cli/core/image.d.ts.map +1 -0
  21. package/dist/cli/{image.js → core/image.js} +6 -8
  22. package/dist/cli/core/index.d.ts +16 -0
  23. package/dist/cli/core/index.d.ts.map +1 -0
  24. package/dist/cli/core/index.js +15 -0
  25. package/dist/cli/core/init.d.ts +9 -0
  26. package/dist/cli/core/init.d.ts.map +1 -0
  27. package/dist/cli/{init.js → core/init.js} +3 -5
  28. package/dist/cli/core/job.d.ts +9 -0
  29. package/dist/cli/core/job.d.ts.map +1 -0
  30. package/dist/cli/{job.js → core/job.js} +7 -9
  31. package/dist/cli/core/namespace.d.ts +9 -0
  32. package/dist/cli/core/namespace.d.ts.map +1 -0
  33. package/dist/cli/{namespace.js → core/namespace.js} +4 -7
  34. package/dist/cli/core/prep-build.d.ts +10 -0
  35. package/dist/cli/core/prep-build.d.ts.map +1 -0
  36. package/dist/cli/{prep-build.js → core/prep-build.js} +6 -8
  37. package/dist/cli/core/registry.d.ts +9 -0
  38. package/dist/cli/core/registry.d.ts.map +1 -0
  39. package/dist/cli/{registry.js → core/registry.js} +5 -7
  40. package/dist/cli/core/run-many.d.ts +10 -0
  41. package/dist/cli/core/run-many.d.ts.map +1 -0
  42. package/dist/cli/{run-many.js → core/run-many.js} +3 -5
  43. package/dist/cli/core/run.d.ts +9 -0
  44. package/dist/cli/core/run.d.ts.map +1 -0
  45. package/dist/cli/{run.js → core/run.js} +6 -8
  46. package/dist/cli/core/test.d.ts +9 -0
  47. package/dist/cli/core/test.d.ts.map +1 -0
  48. package/dist/cli/{test.js → core/test.js} +2 -4
  49. package/dist/cli/exec.sh +21 -0
  50. package/dist/cli/extensions/dml.d.ts +9 -0
  51. package/dist/cli/extensions/dml.d.ts.map +1 -0
  52. package/dist/cli/{dml.js → extensions/dml.js} +2 -4
  53. package/dist/cli/extensions/index.d.ts +9 -0
  54. package/dist/cli/extensions/index.d.ts.map +1 -0
  55. package/dist/cli/extensions/index.js +8 -0
  56. package/dist/cli/extensions/internal-curl.d.ts +10 -0
  57. package/dist/cli/extensions/internal-curl.d.ts.map +1 -0
  58. package/dist/cli/{internal-curl.js → extensions/internal-curl.js} +3 -5
  59. package/dist/cli/extensions/jwt.d.ts +9 -0
  60. package/dist/cli/extensions/jwt.d.ts.map +1 -0
  61. package/dist/cli/{jwt.js → extensions/jwt.js} +3 -5
  62. package/dist/cli/extensions/prisma.d.ts +9 -0
  63. package/dist/cli/extensions/prisma.d.ts.map +1 -0
  64. package/dist/cli/{prisma.js → extensions/prisma.js} +4 -6
  65. package/dist/cli/extensions/redis-bitnami.d.ts +11 -0
  66. package/dist/cli/extensions/redis-bitnami.d.ts.map +1 -0
  67. package/dist/cli/{redis.js → extensions/redis-bitnami.js} +4 -6
  68. package/dist/cli/extensions/redis-ha.d.ts +11 -0
  69. package/dist/cli/extensions/redis-ha.d.ts.map +1 -0
  70. package/dist/cli/extensions/redis-ha.js +51 -0
  71. package/dist/cli/extensions/stackgres.d.ts +10 -0
  72. package/dist/cli/extensions/stackgres.d.ts.map +1 -0
  73. package/dist/cli/{db.js → extensions/stackgres.js} +3 -5
  74. package/dist/cli/extensions/template.d.ts +9 -0
  75. package/dist/cli/extensions/template.d.ts.map +1 -0
  76. package/dist/cli/{template.js → extensions/template.js} +7 -9
  77. package/dist/devops.js +84 -62
  78. package/dist/libs/{k8s-redis.d.ts → k8s-redis-bitnami.d.ts} +1 -1
  79. package/dist/libs/k8s-redis-bitnami.d.ts.map +1 -0
  80. package/dist/libs/k8s-redis-ha.d.ts +3 -0
  81. package/dist/libs/k8s-redis-ha.d.ts.map +1 -0
  82. package/dist/libs/k8s-redis-ha.js +15 -0
  83. package/dist/libs/k8s-secrets-manager.js +2 -2
  84. package/dist/plugins.d.ts +4 -0
  85. package/dist/plugins.d.ts.map +1 -0
  86. package/dist/plugins.js +7 -0
  87. package/dist/types/index.d.ts +3 -0
  88. package/dist/types/index.d.ts.map +1 -1
  89. package/dist/types/index.js +1 -0
  90. package/package.json +12 -2
  91. package/src/cli/{affected.ts → core/affected.ts} +4 -6
  92. package/src/cli/{cloudrun.ts → core/cloudrun.ts} +3 -5
  93. package/src/cli/{console.ts → core/console.ts} +5 -7
  94. package/src/cli/{constant.ts → core/constant.ts} +3 -5
  95. package/src/cli/{env.ts → core/env.ts} +4 -6
  96. package/src/cli/{exec.ts → core/exec.ts} +5 -7
  97. package/src/cli/{image.ts → core/image.ts} +6 -8
  98. package/src/cli/core/index.ts +15 -0
  99. package/src/cli/{init.ts → core/init.ts} +4 -6
  100. package/src/cli/{job.ts → core/job.ts} +7 -9
  101. package/src/cli/{namespace.ts → core/namespace.ts} +4 -8
  102. package/src/cli/{prep-build.ts → core/prep-build.ts} +6 -8
  103. package/src/cli/{registry.ts → core/registry.ts} +5 -7
  104. package/src/cli/{run-many.ts → core/run-many.ts} +3 -5
  105. package/src/cli/{run.ts → core/run.ts} +6 -8
  106. package/src/cli/{test.ts → core/test.ts} +2 -4
  107. package/src/cli/{dml.ts → extensions/dml.ts} +2 -4
  108. package/src/cli/extensions/index.ts +8 -0
  109. package/src/cli/{internal-curl.ts → extensions/internal-curl.ts} +3 -5
  110. package/src/cli/{jwt.ts → extensions/jwt.ts} +3 -5
  111. package/src/cli/{prisma.ts → extensions/prisma.ts} +4 -6
  112. package/src/cli/{redis.ts → extensions/redis-bitnami.ts} +4 -6
  113. package/src/cli/extensions/redis-ha.ts +57 -0
  114. package/src/cli/{db.ts → extensions/stackgres.ts} +3 -5
  115. package/src/cli/{template.ts → extensions/template.ts} +7 -9
  116. package/src/devops.ts +100 -64
  117. package/src/libs/k8s-redis-ha.ts +16 -0
  118. package/src/libs/k8s-secrets-manager.ts +2 -2
  119. package/src/plugins.ts +8 -0
  120. package/src/types/index.ts +1 -0
  121. package/dist/cli/affected.d.ts +0 -11
  122. package/dist/cli/affected.d.ts.map +0 -1
  123. package/dist/cli/cloudrun.d.ts +0 -11
  124. package/dist/cli/cloudrun.d.ts.map +0 -1
  125. package/dist/cli/console.d.ts +0 -11
  126. package/dist/cli/console.d.ts.map +0 -1
  127. package/dist/cli/constant.d.ts +0 -11
  128. package/dist/cli/constant.d.ts.map +0 -1
  129. package/dist/cli/db.d.ts +0 -11
  130. package/dist/cli/db.d.ts.map +0 -1
  131. package/dist/cli/dml.d.ts +0 -11
  132. package/dist/cli/dml.d.ts.map +0 -1
  133. package/dist/cli/env.d.ts +0 -11
  134. package/dist/cli/env.d.ts.map +0 -1
  135. package/dist/cli/exec.d.ts +0 -11
  136. package/dist/cli/exec.d.ts.map +0 -1
  137. package/dist/cli/image.d.ts +0 -11
  138. package/dist/cli/image.d.ts.map +0 -1
  139. package/dist/cli/init.d.ts +0 -11
  140. package/dist/cli/init.d.ts.map +0 -1
  141. package/dist/cli/internal-curl.d.ts +0 -11
  142. package/dist/cli/internal-curl.d.ts.map +0 -1
  143. package/dist/cli/job.d.ts +0 -11
  144. package/dist/cli/job.d.ts.map +0 -1
  145. package/dist/cli/jwt.d.ts +0 -11
  146. package/dist/cli/jwt.d.ts.map +0 -1
  147. package/dist/cli/namespace.d.ts +0 -11
  148. package/dist/cli/namespace.d.ts.map +0 -1
  149. package/dist/cli/prep-build.d.ts +0 -11
  150. package/dist/cli/prep-build.d.ts.map +0 -1
  151. package/dist/cli/prisma.d.ts +0 -11
  152. package/dist/cli/prisma.d.ts.map +0 -1
  153. package/dist/cli/redis.d.ts +0 -11
  154. package/dist/cli/redis.d.ts.map +0 -1
  155. package/dist/cli/registry.d.ts +0 -11
  156. package/dist/cli/registry.d.ts.map +0 -1
  157. package/dist/cli/run-many.d.ts +0 -11
  158. package/dist/cli/run-many.d.ts.map +0 -1
  159. package/dist/cli/run.d.ts +0 -11
  160. package/dist/cli/run.d.ts.map +0 -1
  161. package/dist/cli/template.d.ts +0 -11
  162. package/dist/cli/template.d.ts.map +0 -1
  163. package/dist/cli/test.d.ts +0 -11
  164. package/dist/cli/test.d.ts.map +0 -1
  165. package/dist/libs/k8s-redis.d.ts.map +0 -1
  166. /package/dist/libs/{k8s-redis.js → k8s-redis-bitnami.js} +0 -0
  167. /package/src/libs/{k8s-redis.ts → k8s-redis-bitnami.ts} +0 -0
@@ -3,9 +3,9 @@ import {
3
3
  findImagesWithAffectedWorkspace,
4
4
  isImageAffected,
5
5
  isWorkspaceAffected,
6
- } from "../libs/affected-entities";
7
- import { getImageData } from "../libs/config";
8
- import { CLICommandParser, printUsageAndExit, StrongParams } from "./common";
6
+ } from "../../libs/affected-entities";
7
+ import { getImageData } from "../../libs/config";
8
+ import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
9
9
 
10
10
  const oneLiner =
11
11
  "Command to check whether an image or a workspace is affected by certain commit(s)";
@@ -111,6 +111,4 @@ async function run(cmdObj: CLICommandParser) {
111
111
  }
112
112
  }
113
113
 
114
- export default {
115
- affected: { oneLiner, keyExamples, run },
116
- };
114
+ export const affected = { oneLiner, keyExamples, run };
@@ -1,5 +1,5 @@
1
- import { CLICommandParser, printUsageAndExit, StrongParams } from "./common";
2
- import { buildDev, deploy } from "../libs/cloudrun-helpers";
1
+ import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
2
+ import { buildDev, deploy } from "../../libs/cloudrun-helpers";
3
3
 
4
4
  const oneLiner =
5
5
  "Supports cloudrun images";
@@ -128,6 +128,4 @@ async function run(cmdObj: CLICommandParser) {
128
128
  handler(params);
129
129
  }
130
130
 
131
- export default {
132
- cloudrun: { oneLiner, keyExamples, run },
133
- };
131
+ export const cloudrun = { oneLiner, keyExamples, run };
@@ -1,10 +1,10 @@
1
- import { getConst } from "../libs/config";
1
+ import { getConst } from "../../libs/config";
2
2
  import {
3
3
  envToNamespace,
4
4
  imageDebugName,
5
- } from "../libs/k8s-constants";
6
- import { kubectlCommand } from "../libs/k8s-helpers";
7
- import { CLICommandParser, printUsageAndExit } from "./common";
5
+ } from "../../libs/k8s-constants";
6
+ import { kubectlCommand } from "../../libs/k8s-helpers";
7
+ import { CLICommandParser, printUsageAndExit } from "../common";
8
8
 
9
9
  const oneLiner = "Get a shell into the debug pod of an image";
10
10
  const keyExamples = `
@@ -41,6 +41,4 @@ function run(cmdObj: CLICommandParser) {
41
41
  .spawn();
42
42
  }
43
43
 
44
- export default {
45
- console: { oneLiner, keyExamples, run },
46
- };
44
+ export const console = { oneLiner, keyExamples, run };
@@ -1,5 +1,5 @@
1
- import { getConst } from "../libs/config";
2
- import { CLICommandParser, printUsageAndExit } from "./common";
1
+ import { getConst } from "../../libs/config";
2
+ import { CLICommandParser, printUsageAndExit } from "../common";
3
3
 
4
4
  const oneLiner = "Prints to stdout a constant from constant.yaml";
5
5
  const keyExamples = `$ devops constant infra`;
@@ -20,6 +20,4 @@ async function run(cmdObj: CLICommandParser) {
20
20
  console.log(getConst(constant as any));
21
21
  }
22
22
 
23
- export default {
24
- constant: { oneLiner, keyExamples, run },
25
- };
23
+ export const constant = { oneLiner, keyExamples, run };
@@ -3,13 +3,13 @@ import {
3
3
  deleteMonorepoSecret,
4
4
  getMonorepoSecretStr,
5
5
  setMonorepoSecret,
6
- } from "../libs/k8s-secrets-manager";
7
- import { CombinedEnvValidator } from "../libs/validate-env";
6
+ } from "../../libs/k8s-secrets-manager";
7
+ import { CombinedEnvValidator } from "../../libs/validate-env";
8
8
  import {
9
9
  CLICommandParser,
10
10
  dotEnvFilesForEnv,
11
11
  printUsageAndExit,
12
- } from "./common";
12
+ } from "../common";
13
13
 
14
14
  const oneLiner = "Commands to manipulate env variables";
15
15
  const keyExamples = `
@@ -82,6 +82,4 @@ function run(cmdObj: CLICommandParser) {
82
82
  }
83
83
  }
84
84
 
85
- export default {
86
- env: { oneLiner, keyExamples, run },
87
- };
85
+ export const env = { oneLiner, keyExamples, run };
@@ -1,11 +1,11 @@
1
- import { CLICommandParser, CommandExecutor, printUsageAndExit } from "./common";
1
+ import { CLICommandParser, CommandExecutor, printUsageAndExit } from "../common";
2
2
  import url from "url";
3
3
  import path from "path";
4
- import { getWorkspace } from "../libs/discovery";
4
+ import { getWorkspace } from "../../libs/discovery";
5
5
 
6
6
  const __file__ = url.fileURLToPath(import.meta.url);
7
- const __src__ = path.join(path.dirname(__file__), "../..", "src");
8
- const execShPath = path.join(__src__, "cli/exec.sh");
7
+ const __cli__ = path.join(path.dirname(__file__), "../..", "cli");
8
+ const execShPath = path.join(__cli__, "exec.sh");
9
9
 
10
10
  const oneLiner =
11
11
  "Executes a command after injecting env variables, either globally or in a workspace";
@@ -52,6 +52,4 @@ function run(cmdObj: CLICommandParser) {
52
52
  }
53
53
  }
54
54
 
55
- export default {
56
- exec: { oneLiner, keyExamples, run },
57
- };
55
+ export const exec = { oneLiner, keyExamples, run };
@@ -1,8 +1,8 @@
1
- import { deleteImageVersion, getImageVersion, getWorkspaceScale, resetWorkspaceScale, setImageVersion, setWorkspaceScale } from "../libs/k8s-image-config";
2
- import { CLICommandParser, printUsageAndExit, StrongParams } from "../../src/cli/common";
3
- import { generateImageDeployments } from "../libs/k8s-generate";
4
- import { applyHandler } from "../libs/k8s-helpers";
5
- import { getImageType } from "../libs/config";
1
+ import { deleteImageVersion, getImageVersion, getWorkspaceScale, resetWorkspaceScale, setImageVersion, setWorkspaceScale } from "../../libs/k8s-image-config";
2
+ import { CLICommandParser, printUsageAndExit, StrongParams } from "../../../src/cli/common";
3
+ import { generateImageDeployments } from "../../libs/k8s-generate";
4
+ import { applyHandler } from "../../libs/k8s-helpers";
5
+ import { getImageType } from "../../libs/config";
6
6
 
7
7
  const oneLiner = "Applies image-related manifests, retrieves or set the version deployed, and scales deployments of applications";
8
8
  const keyExamples = `
@@ -206,6 +206,4 @@ function run(cmdObj: CLICommandParser) {
206
206
  handler(params);
207
207
  }
208
208
 
209
- export default {
210
- image: { oneLiner, keyExamples, run },
211
- };
209
+ export const image = { oneLiner, keyExamples, run };
@@ -0,0 +1,15 @@
1
+ export * from "./run";
2
+ export * from "./run-many";
3
+ export * from "./exec";
4
+ export * from "./affected";
5
+ export * from "./cloudrun";
6
+ export * from "./console";
7
+ export * from "./constant";
8
+ export * from "./env";
9
+ export * from "./image";
10
+ export * from "./init";
11
+ export * from "./job";
12
+ export * from "./namespace";
13
+ export * from "./prep-build";
14
+ export * from "./registry";
15
+ export * from "./test";
@@ -1,9 +1,9 @@
1
1
  import inquirer from "inquirer";
2
- import { InitGenerator, type InitGeneratorFileInfo } from "../libs/init-generator";
3
- import { CLICommandParser, printUsageAndExit } from "./common";
2
+ import { InitGenerator, type InitGeneratorFileInfo } from "../../libs/init-generator";
3
+ import { CLICommandParser, printUsageAndExit } from "../common";
4
4
  import chalk from "chalk";
5
5
  import fs from 'fs-extra';
6
- import type { ConstFileSchema } from "../types";
6
+ import type { ConstFileSchema } from "../../types";
7
7
 
8
8
  const oneLiner =
9
9
  "Initializes the devops utility by copying template files to the current folder";
@@ -24,9 +24,7 @@ async function run(cmdObj: CLICommandParser) {
24
24
  createFiles();
25
25
  }
26
26
 
27
- export default {
28
- init: { oneLiner, keyExamples, run },
29
- };
27
+ export const init = { oneLiner, keyExamples, run };
30
28
 
31
29
  async function createFiles() {
32
30
  const tc = new InitGenerator();
@@ -1,10 +1,10 @@
1
1
  import {
2
- } from "../libs/k8s-image-config";
3
- import { CLICommandParser, printUsageAndExit, StrongParams } from "../../src/cli/common";
4
- import { generateDbMigrateJob } from "../libs/k8s-generate";
5
- import { applyHandler } from "../libs/k8s-helpers";
6
- import { k8sJobWaiter, printJobStatuses } from "../libs/k8s-job-waiter";
7
- import { dbMigrateJobName } from "../libs/k8s-constants";
2
+ } from "../../libs/k8s-image-config";
3
+ import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
4
+ import { generateDbMigrateJob } from "../../libs/k8s-generate";
5
+ import { applyHandler } from "../../libs/k8s-helpers";
6
+ import { k8sJobWaiter, printJobStatuses } from "../../libs/k8s-job-waiter";
7
+ import { dbMigrateJobName } from "../../libs/k8s-constants";
8
8
 
9
9
  const oneLiner = "Creates a k8s job and waits for it to run";
10
10
  const keyExamples = `
@@ -75,6 +75,4 @@ function run(cmdObj: CLICommandParser) {
75
75
  handler(params);
76
76
  }
77
77
 
78
- export default {
79
- job: { oneLiner, keyExamples, run },
80
- };
78
+ export const job = { oneLiner, keyExamples, run };
@@ -1,11 +1,9 @@
1
- import {
2
- } from "../libs/k8s-image-config";
3
- import { CLICommandParser, printUsageAndExit, StrongParams } from "../../src/cli/common";
1
+ import { CLICommandParser, printUsageAndExit, StrongParams } from "../../../src/cli/common";
4
2
  import {
5
3
  copySecretHarborToNamespace,
6
4
  patchServiceAccountImagePullSecret,
7
- } from "../../src/libs/hetzner/reg-secret";
8
- import { checkEnvSetup, createEmptyEnvSecret, createNamespace, deleteNamespace, patchBaseSecret } from "../libs/k8s-namespace";
5
+ } from "../../../src/libs/hetzner/reg-secret";
6
+ import { checkEnvSetup, createEmptyEnvSecret, createNamespace, deleteNamespace, patchBaseSecret } from "../../libs/k8s-namespace";
9
7
 
10
8
  const oneLiner = "Creates the basic prerequisites for a monorepo";
11
9
  const keyExamples = `
@@ -73,6 +71,4 @@ function run(cmdObj: CLICommandParser) {
73
71
  handler(params);
74
72
  }
75
73
 
76
- export default {
77
- namespace: { oneLiner, keyExamples, run },
78
- };
74
+ export const namespace = { oneLiner, keyExamples, run };
@@ -1,11 +1,11 @@
1
1
  import fs from "fs-extra";
2
2
  import os from "os";
3
3
  import path from "path";
4
- import { CLICommandParser, printUsageAndExit } from "./common";
5
- import { getImageData, getTemplateData } from "../libs/config";
6
- import { getMonorepoSecretStr } from "../libs/k8s-secrets-manager";
7
- import { getImageDescendentData } from "../libs/discovery/images";
8
- import { isLocalOrRemoteEnv } from "../libs/k8s-constants";
4
+ import { CLICommandParser, printUsageAndExit } from "../common";
5
+ import { getImageData, getTemplateData } from "../../libs/config";
6
+ import { getMonorepoSecretStr } from "../../libs/k8s-secrets-manager";
7
+ import { getImageDescendentData } from "../../libs/discovery/images";
8
+ import { isLocalOrRemoteEnv } from "../../libs/k8s-constants";
9
9
  import chalk from "chalk";
10
10
 
11
11
  const oneLiner =
@@ -119,6 +119,4 @@ async function run(cmdObj: CLICommandParser) {
119
119
  console.log(destFolder);
120
120
  }
121
121
 
122
- export default {
123
- "prep-build": { oneLiner, keyExamples, run },
124
- };
122
+ export const prepBuild = { command: 'prep-build', oneLiner, keyExamples, run };
@@ -1,11 +1,11 @@
1
- import { getConst, getImageData } from "../libs/config";
2
- import { prune } from "../libs/digital-ocean/container-reg";
1
+ import { getConst } from "../../libs/config";
2
+ import { prune } from "../../libs/digital-ocean/container-reg";
3
3
  import {
4
4
  containerRegistryPath,
5
5
  containerRegistryImageName,
6
6
  containerRegistryRepoPath,
7
- } from "../libs/k8s-constants";
8
- import { CLICommandParser, StrongParams, printUsageAndExit } from "./common";
7
+ } from "../../libs/k8s-constants";
8
+ import { CLICommandParser, StrongParams, printUsageAndExit } from "../common";
9
9
 
10
10
  const oneLiner = "Manage container repositories";
11
11
  const keyExamples = `
@@ -81,6 +81,4 @@ function run(cmdObj: CLICommandParser) {
81
81
  handler(params);
82
82
  }
83
83
 
84
- export default {
85
- registry: { oneLiner, keyExamples, run },
86
- };
84
+ export const registry = { oneLiner, keyExamples, run };
@@ -1,5 +1,5 @@
1
- import { workspaceDirectoryForLanguage } from "../libs/discovery";
2
- import { CLICommandParser, printUsageAndExit } from "./common";
1
+ import { workspaceDirectoryForLanguage } from "../../libs/discovery";
2
+ import { CLICommandParser, printUsageAndExit } from "../common";
3
3
  import concurrently, {
4
4
  type ConcurrentlyCommandInput,
5
5
  type ConcurrentlyOptions,
@@ -56,6 +56,4 @@ async function run(cmdObj: CLICommandParser) {
56
56
  });
57
57
  }
58
58
 
59
- export default {
60
- "run-many": { oneLiner, keyExamples, run },
61
- };
59
+ export const runMany = { command: 'run-many', oneLiner, keyExamples, run };
@@ -1,11 +1,11 @@
1
- import { CLICommandParser, printUsageAndExit } from "./common";
1
+ import { CLICommandParser, printUsageAndExit } from "../common";
2
2
  import url from "url";
3
3
  import path from "path";
4
- import { getWorkspace } from "../libs/discovery";
4
+ import { getWorkspace } from "../../libs/discovery";
5
5
 
6
6
  const __file__ = url.fileURLToPath(import.meta.url);
7
- const __src__ = path.join(path.dirname(__file__), "../..", "src");
8
- const execShPath = path.join(__src__, "cli/exec.sh");
7
+ const __cli__ = path.join(path.dirname(__file__), "../..", "cli");
8
+ const execShPath = path.join(__cli__, "exec.sh");
9
9
 
10
10
  const oneLiner =
11
11
  "Runs a script defined in package.json after injecting env variables";
@@ -25,7 +25,7 @@ EXAMPLES
25
25
  ${keyExamples}
26
26
  `;
27
27
 
28
- async function run(cmdObj: CLICommandParser) {
28
+ async function runFn(cmdObj: CLICommandParser) {
29
29
  if (cmdObj.help || cmdObj.args.length === 0) printUsageAndExit(usage);
30
30
  const [workspace, script] = cmdObj.args[0].split(":");
31
31
  if (!workspace || !script) printUsageAndExit(usage);
@@ -41,6 +41,4 @@ async function run(cmdObj: CLICommandParser) {
41
41
  .spawn();
42
42
  }
43
43
 
44
- export default {
45
- run: { oneLiner, keyExamples, run },
46
- };
44
+ export const run = { oneLiner, keyExamples, run: runFn };
@@ -1,4 +1,4 @@
1
- import { CLICommandParser, CommandExecutor, printUsageAndExit } from "./common";
1
+ import { CLICommandParser, CommandExecutor, printUsageAndExit } from "../common";
2
2
 
3
3
  const oneLiner = "Runs tests in all projects or one specific project";
4
4
  const keyExamples = `
@@ -25,6 +25,4 @@ function run(cmdObj: CLICommandParser) {
25
25
  }
26
26
  }
27
27
 
28
- export default {
29
- test: { oneLiner, keyExamples, run },
30
- };
28
+ export const test = { oneLiner, keyExamples, run };
@@ -1,5 +1,5 @@
1
1
  import fs from "fs";
2
- import { CLICommandParser, printUsageAndExit } from "./common";
2
+ import { CLICommandParser, printUsageAndExit } from "../common";
3
3
 
4
4
  const oneLiner = "Utilities to manage and run DML scripts in the db project";
5
5
  const keyExamples = `
@@ -121,6 +121,4 @@ function run(cmdObj: CLICommandParser) {
121
121
  }
122
122
  }
123
123
 
124
- export default {
125
- dml: { oneLiner, keyExamples, run },
126
- };
124
+ export const dml = { oneLiner, keyExamples, run };
@@ -0,0 +1,8 @@
1
+ export * from "./dml";
2
+ export * from "./internal-curl";
3
+ export * from "./jwt";
4
+ export * from "./prisma";
5
+ export * from "./redis-bitnami";
6
+ export * from "./redis-ha";
7
+ export * from "./stackgres";
8
+ export * from "./template";
@@ -1,5 +1,5 @@
1
- import { InternalToken } from "../app-support/crypto";
2
- import { CLICommandParser, printUsageAndExit } from "./common";
1
+ import { InternalToken } from "../../app-support/crypto";
2
+ import { CLICommandParser, printUsageAndExit } from "../common";
3
3
 
4
4
  const oneLiner =
5
5
  "Runs a curl command bearing an internal jwt-like token to allow verifying internal communication within the namespace";
@@ -43,6 +43,4 @@ async function run(cmdObj: CLICommandParser) {
43
43
  cmdObj.executorFromEnv(`curl -H "Authorization: Bearer ${token}" ${rest.join(" ")}`).exec();
44
44
  }
45
45
 
46
- export default {
47
- 'internal-curl': { oneLiner, keyExamples, run },
48
- };
46
+ export const internalCurl = { command: 'internal-curl', oneLiner, keyExamples, run };
@@ -1,5 +1,5 @@
1
- import { InternalToken } from "../app-support/crypto";
2
- import { CLICommandParser, printUsageAndExit } from "./common";
1
+ import { InternalToken } from "../../app-support/crypto";
2
+ import { CLICommandParser, printUsageAndExit } from "../common";
3
3
 
4
4
  const oneLiner =
5
5
  "Returns a JWT-like token to allow verifying internal communication within the namespace";
@@ -27,6 +27,4 @@ async function run(cmdObj: CLICommandParser) {
27
27
  console.log(new InternalToken(subject).generate());
28
28
  }
29
29
 
30
- export default {
31
- jwt: { oneLiner, keyExamples, run },
32
- };
30
+ export const jwt = { oneLiner, keyExamples, run };
@@ -1,10 +1,10 @@
1
- import { CLICommandParser, printUsageAndExit } from "./common";
1
+ import { CLICommandParser } from "../common";
2
2
  import url from "url";
3
3
  import path from "path";
4
4
 
5
5
  const __file__ = url.fileURLToPath(import.meta.url);
6
- const __src__ = path.join(path.dirname(__file__), "../..", "src");
7
- const execShPath = path.join(__src__, "cli/exec.sh");
6
+ const __cli__ = path.join(path.dirname(__file__), "../..", "cli");
7
+ const execShPath = path.join(__cli__, "exec.sh");
8
8
 
9
9
  const oneLiner = "Runs prisma commands in the db project after injecting the environment variables";
10
10
  const keyExamples = `$ devops prisma migrate dev`;
@@ -28,6 +28,4 @@ async function run(cmdObj: CLICommandParser) {
28
28
  ).spawn()
29
29
  }
30
30
 
31
- export default {
32
- prisma: { oneLiner, keyExamples, run },
33
- };
31
+ export const prisma = { oneLiner, keyExamples, run };
@@ -1,9 +1,9 @@
1
1
  import chalk from "chalk";
2
- import { establishRedisTunnel, getRedisList, getRedisPassword } from "../libs/k8s-redis";
3
- import { CLICommandParser, printUsageAndExit, StrongParams } from "./common";
2
+ import { establishRedisTunnel, getRedisList, getRedisPassword } from "../../libs/k8s-redis-bitnami";
3
+ import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
4
4
 
5
5
  const oneLiner =
6
- "Utilities to help accessing production and staging redis";
6
+ "Utilities to help accessing production and staging redis installation from Bitnami";
7
7
  const keyExamples = `
8
8
  $ devops redis list
9
9
  $ devops redis password redis-staging
@@ -78,6 +78,4 @@ function run(cmdObj: CLICommandParser) {
78
78
  handler(params);
79
79
  }
80
80
 
81
- export default {
82
- redis: { oneLiner, keyExamples, run },
83
- };
81
+ export const redisBitnami = { name: 'redis-bitnami', command: 'redis', oneLiner, keyExamples, run };
@@ -0,0 +1,57 @@
1
+ import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
2
+ import { establishRedisTunnel, getRedisList } from "../../libs/k8s-redis-ha";
3
+
4
+ const oneLiner =
5
+ "Utilities to help accessing production and staging redis installation from redis-ha";
6
+ const keyExamples = `
7
+ $ devops redis list
8
+ $ devops redis tunnel redis-staging
9
+ `.trim();
10
+
11
+ const usage = `
12
+ ${oneLiner}
13
+
14
+ COMMANDS
15
+ list Lists the available redis installations
16
+ tunnel <namespace> [-p <port>] Sets up a tunnel to the remote Redis instance so you can access the DB from your local machine on port 9379 by default
17
+
18
+ NOTES
19
+ This command assumes the namespace and the helm release name are the same.
20
+ The --env flag should not be used with these commands, as the Redis namespaces follow different conventions than the monorepo env.
21
+
22
+ EXAMPLES
23
+ ${keyExamples}
24
+ `;
25
+
26
+ const handlers = {
27
+ list: () => {
28
+ const res = getRedisList();
29
+ console.log(res);
30
+ },
31
+ tunnel: (opts: StrongParams) => {
32
+ const namespace = opts.required("namespace");
33
+ const port = opts.optional("port") ?? '9379';
34
+ establishRedisTunnel(namespace, port);
35
+ },
36
+ };
37
+
38
+ function run(cmdObj: CLICommandParser) {
39
+ if (cmdObj.help || cmdObj.args.length < 1) printUsageAndExit(usage);
40
+ const parsed = cmdObj.parseOptions({ params: ["-p"] });
41
+
42
+ const [command, namespace] = parsed.args;
43
+ const port = parsed.options["-p"];
44
+ // @ts-expect-error left as an exercise for the reader
45
+ const handler = handlers[command];
46
+ if (!handler) {
47
+ console.error(`Unknown command: ${command}`);
48
+ printUsageAndExit(usage);
49
+ }
50
+ const params = new StrongParams(usage, {
51
+ namespace,
52
+ port,
53
+ });
54
+ handler(params);
55
+ }
56
+
57
+ export const redisHa = { name: 'redis-ha', command: 'redis', oneLiner, keyExamples, run };
@@ -6,8 +6,8 @@ import {
6
6
  getDbBackups,
7
7
  getDbList,
8
8
  getDbPasswords,
9
- } from "../libs/k8s-db";
10
- import { CLICommandParser, printUsageAndExit, StrongParams } from "./common";
9
+ } from "../../libs/k8s-db";
10
+ import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
11
11
 
12
12
  const oneLiner =
13
13
  "Utilities to help day to day operations of production and staging databases";
@@ -128,6 +128,4 @@ function run(cmdObj: CLICommandParser) {
128
128
  handler(params);
129
129
  }
130
130
 
131
- export default {
132
- db: { oneLiner, keyExamples, run },
133
- };
131
+ export const stackgres = { command: 'db', oneLiner, keyExamples, run };
@@ -1,11 +1,11 @@
1
1
  import {
2
- } from "../libs/k8s-image-config";
3
- import { CLICommandParser, printUsageAndExit, StrongParams } from "../../src/cli/common";
4
- import { generateDbMigrateJob, generateDebugDeployment, generateWorkspaceDeployment, ImageContextGenerator } from "../libs/k8s-generate";
2
+ } from "../../libs/k8s-image-config";
3
+ import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
4
+ import { generateDbMigrateJob, generateDebugDeployment, generateWorkspaceDeployment, ImageContextGenerator } from "../../libs/k8s-generate";
5
5
  import chalk from "chalk";
6
- import { getWorkspace } from "../libs/discovery";
7
- import { getWorkspaceImages } from "../libs/discovery/images";
8
- import { getImageData, getImageNames } from "../libs/config";
6
+ import { getWorkspace } from "../../libs/discovery";
7
+ import { getWorkspaceImages } from "../../libs/discovery/images";
8
+ import { getImageData, getImageNames } from "../../libs/config";
9
9
 
10
10
  const SUPPORTED_CONTEXT_TYPES = ['deployment', 'db-migrate', 'debug'];
11
11
 
@@ -164,6 +164,4 @@ function run(cmdObj: CLICommandParser) {
164
164
  handler(params);
165
165
  }
166
166
 
167
- export default {
168
- template: { oneLiner, keyExamples, run },
169
- };
167
+ export const template = { oneLiner, keyExamples, run };