@catladder/cli 0.0.0-test3 → 0.0.0-yarnrc-support-bdbef31f

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 (292) hide show
  1. package/.nvmrc +1 -1
  2. package/README.md +4 -2
  3. package/bin/catenv +3 -0
  4. package/bin/catladder +1 -1
  5. package/dist/apps/catenv/catenv.d.ts +2 -0
  6. package/dist/apps/catenv/catenv.js +135 -0
  7. package/dist/apps/catenv/catenv.js.map +1 -0
  8. package/dist/apps/cli/cli.d.ts +2 -0
  9. package/dist/apps/cli/cli.js +81 -0
  10. package/dist/apps/cli/cli.js.map +1 -0
  11. package/dist/apps/cli/commands/general/index.d.ts +4 -0
  12. package/dist/apps/cli/commands/general/index.js +208 -0
  13. package/dist/apps/cli/commands/general/index.js.map +1 -0
  14. package/dist/apps/cli/commands/general/namespaceAutoCompletion.d.ts +3 -0
  15. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js +56 -0
  16. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js.map +1 -0
  17. package/dist/apps/cli/commands/general/portForward.d.ts +3 -0
  18. package/dist/apps/cli/commands/general/portForward.js +98 -0
  19. package/dist/apps/cli/commands/general/portForward.js.map +1 -0
  20. package/dist/apps/cli/commands/mongodb/index.d.ts +3 -0
  21. package/dist/apps/cli/commands/mongodb/index.js +53 -0
  22. package/dist/apps/cli/commands/mongodb/index.js.map +1 -0
  23. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +3 -0
  24. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +190 -0
  25. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -0
  26. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +3 -0
  27. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js +96 -0
  28. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js.map +1 -0
  29. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +3 -0
  30. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +105 -0
  31. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -0
  32. package/dist/apps/cli/commands/mongodb/utils/index.d.ts +13 -0
  33. package/dist/apps/cli/commands/mongodb/utils/index.js +167 -0
  34. package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -0
  35. package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +3 -0
  36. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +129 -0
  37. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
  38. package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +3 -0
  39. package/dist/apps/cli/commands/project/commandConfigSecrets.js +294 -0
  40. package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -0
  41. package/dist/apps/cli/commands/project/commandCopyDB.d.ts +3 -0
  42. package/dist/apps/cli/commands/project/commandCopyDB.js +102 -0
  43. package/dist/apps/cli/commands/project/commandCopyDB.js.map +1 -0
  44. package/dist/apps/cli/commands/project/commandDeletePods.d.ts +3 -0
  45. package/dist/apps/cli/commands/project/commandDeletePods.js +119 -0
  46. package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -0
  47. package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +3 -0
  48. package/dist/apps/cli/commands/project/commandDeleteProject.js +97 -0
  49. package/dist/apps/cli/commands/project/commandDeleteProject.js.map +1 -0
  50. package/dist/apps/cli/commands/project/commandEnvVars.d.ts +3 -0
  51. package/dist/apps/cli/commands/project/commandEnvVars.js +74 -0
  52. package/dist/apps/cli/commands/project/commandEnvVars.js.map +1 -0
  53. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +3 -0
  54. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +58 -0
  55. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -0
  56. package/dist/apps/cli/commands/project/commandGetShell.d.ts +3 -0
  57. package/dist/apps/cli/commands/project/commandGetShell.js +92 -0
  58. package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -0
  59. package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +3 -0
  60. package/dist/apps/cli/commands/project/commandGitlabCi.js +185 -0
  61. package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -0
  62. package/dist/apps/cli/commands/project/commandInitGitlab.d.ts +3 -0
  63. package/dist/apps/cli/commands/project/commandInitGitlab.js +136 -0
  64. package/dist/apps/cli/commands/project/commandInitGitlab.js.map +1 -0
  65. package/dist/apps/cli/commands/project/commandInitProject.d.ts +3 -0
  66. package/dist/apps/cli/commands/project/commandInitProject.js +345 -0
  67. package/dist/apps/cli/commands/project/commandInitProject.js.map +1 -0
  68. package/dist/apps/cli/commands/project/commandListPods.d.ts +3 -0
  69. package/dist/apps/cli/commands/project/commandListPods.js +78 -0
  70. package/dist/apps/cli/commands/project/commandListPods.js.map +1 -0
  71. package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +7 -0
  72. package/dist/apps/cli/commands/project/commandMigrateHelm3.js +113 -0
  73. package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -0
  74. package/dist/apps/cli/commands/project/commandNamespace.d.ts +3 -0
  75. package/dist/apps/cli/commands/project/commandNamespace.js +70 -0
  76. package/dist/apps/cli/commands/project/commandNamespace.js.map +1 -0
  77. package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +3 -0
  78. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +83 -0
  79. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -0
  80. package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +3 -0
  81. package/dist/apps/cli/commands/project/commandOpenDashboard.js +85 -0
  82. package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -0
  83. package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +3 -0
  84. package/dist/apps/cli/commands/project/commandOpenEnv.js +80 -0
  85. package/dist/apps/cli/commands/project/commandOpenEnv.js.map +1 -0
  86. package/dist/apps/cli/commands/project/commandOpenGit.d.ts +3 -0
  87. package/dist/apps/cli/commands/project/commandOpenGit.js +61 -0
  88. package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -0
  89. package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +3 -0
  90. package/dist/apps/cli/commands/project/commandOpenGrafana.js +83 -0
  91. package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -0
  92. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +3 -0
  93. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +99 -0
  94. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -0
  95. package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +3 -0
  96. package/dist/apps/cli/commands/project/commandOpenLogs.js +87 -0
  97. package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -0
  98. package/dist/apps/cli/commands/project/commandPauseProject.d.ts +3 -0
  99. package/dist/apps/cli/commands/project/commandPauseProject.js +97 -0
  100. package/dist/apps/cli/commands/project/commandPauseProject.js.map +1 -0
  101. package/dist/apps/cli/commands/project/commandPortForward.d.ts +3 -0
  102. package/dist/apps/cli/commands/project/commandPortForward.js +106 -0
  103. package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
  104. package/dist/apps/cli/commands/project/commandReloadConfig.d.ts +3 -0
  105. package/dist/apps/cli/commands/project/commandReloadConfig.js +62 -0
  106. package/dist/apps/cli/commands/project/commandReloadConfig.js.map +1 -0
  107. package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
  108. package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
  109. package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
  110. package/dist/apps/cli/commands/project/index.d.ts +3 -0
  111. package/dist/apps/cli/commands/project/index.js +97 -0
  112. package/dist/apps/cli/commands/project/index.js.map +1 -0
  113. package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
  114. package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
  115. package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
  116. package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +1 -0
  117. package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
  118. package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
  119. package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -0
  120. package/dist/apps/cli/commands/project/utils/ensureNamespace.js +106 -0
  121. package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
  122. package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +2 -0
  123. package/dist/apps/cli/commands/project/utils/showProjectBanner.js +58 -0
  124. package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -0
  125. package/dist/apps/cli/commands/shared/index.d.ts +3 -0
  126. package/dist/apps/cli/commands/shared/index.js +70 -0
  127. package/dist/apps/cli/commands/shared/index.js.map +1 -0
  128. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
  129. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +101 -0
  130. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
  131. package/dist/apps/cli/config/writeConfig.d.ts +5 -0
  132. package/dist/apps/cli/config/writeConfig.js +106 -0
  133. package/dist/apps/cli/config/writeConfig.js.map +1 -0
  134. package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -0
  135. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
  136. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
  137. package/dist/apps/cli/verify/index.d.ts +2 -0
  138. package/dist/apps/cli/verify/index.js +94 -0
  139. package/dist/apps/cli/verify/index.js.map +1 -0
  140. package/dist/apps/cli/verify/migration/fromv2.d.ts +4 -0
  141. package/dist/apps/cli/verify/migration/fromv2.js +345 -0
  142. package/dist/apps/cli/verify/migration/fromv2.js.map +1 -0
  143. package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +4 -0
  144. package/dist/apps/cli/verify/migration/migrateSecrets.js +88 -0
  145. package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -0
  146. package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +18 -0
  147. package/dist/apps/cli/verify/migration/oldGitlabCi.js +30 -0
  148. package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
  149. package/dist/catenv.d.ts +1 -0
  150. package/dist/catenv.js +10 -0
  151. package/dist/catenv.js.map +1 -0
  152. package/dist/cli.d.ts +1 -0
  153. package/dist/cli.js +15 -0
  154. package/dist/cli.js.map +1 -0
  155. package/dist/config/constants.d.ts +3 -0
  156. package/dist/config/constants.js +7 -0
  157. package/dist/config/constants.js.map +1 -0
  158. package/dist/config/getProjectConfig.d.ts +24 -0
  159. package/dist/config/getProjectConfig.js +232 -0
  160. package/dist/config/getProjectConfig.js.map +1 -0
  161. package/dist/k8sApi/index.d.ts +6 -0
  162. package/dist/k8sApi/index.js +15 -0
  163. package/dist/k8sApi/index.js.map +1 -0
  164. package/dist/packageInfos.d.ts +2 -0
  165. package/dist/packageInfos.js +6 -0
  166. package/dist/packageInfos.js.map +1 -0
  167. package/dist/tsconfig.tsbuildinfo +1 -0
  168. package/dist/types/types.d.ts +18 -0
  169. package/dist/types/types.js +3 -0
  170. package/dist/types/types.js.map +1 -0
  171. package/dist/utils/cluster.d.ts +3 -0
  172. package/dist/utils/cluster.js +75 -0
  173. package/dist/utils/cluster.js.map +1 -0
  174. package/dist/utils/editAsFile.d.ts +1 -0
  175. package/dist/utils/editAsFile.js +85 -0
  176. package/dist/utils/editAsFile.js.map +1 -0
  177. package/dist/utils/files.d.ts +2 -0
  178. package/dist/utils/files.js +83 -0
  179. package/dist/utils/files.js.map +1 -0
  180. package/dist/utils/formatEnvVars.d.ts +2 -0
  181. package/dist/utils/formatEnvVars.js +10 -0
  182. package/dist/utils/formatEnvVars.js.map +1 -0
  183. package/dist/utils/getEditor.d.ts +4 -0
  184. package/dist/utils/getEditor.js +70 -0
  185. package/dist/utils/getEditor.js.map +1 -0
  186. package/dist/utils/gitlab.d.ts +21 -0
  187. package/dist/utils/gitlab.js +262 -0
  188. package/dist/utils/gitlab.js.map +1 -0
  189. package/dist/utils/log.d.ts +1 -0
  190. package/dist/utils/log.js +14 -0
  191. package/dist/utils/log.js.map +1 -0
  192. package/dist/utils/passwordstore/index.d.ts +8 -0
  193. package/dist/utils/passwordstore/index.js +378 -0
  194. package/dist/utils/passwordstore/index.js.map +1 -0
  195. package/dist/utils/portForward.d.ts +4 -0
  196. package/dist/utils/portForward.js +116 -0
  197. package/dist/utils/portForward.js.map +1 -0
  198. package/dist/utils/preferences/index.d.ts +3 -0
  199. package/dist/utils/preferences/index.js +119 -0
  200. package/dist/utils/preferences/index.js.map +1 -0
  201. package/dist/utils/projects/index.d.ts +8 -0
  202. package/dist/utils/projects/index.js +154 -0
  203. package/dist/utils/projects/index.js.map +1 -0
  204. package/dist/utils/promise.d.ts +2 -0
  205. package/dist/utils/promise.js +62 -0
  206. package/dist/utils/promise.js.map +1 -0
  207. package/dist/utils/shell.d.ts +1 -0
  208. package/dist/utils/shell.js +81 -0
  209. package/dist/utils/shell.js.map +1 -0
  210. package/package.json +16 -21
  211. package/src/apps/catenv/catenv.ts +48 -27
  212. package/src/apps/{shell/shell.ts → cli/cli.ts} +10 -2
  213. package/src/apps/{shell → cli}/commands/general/index.ts +2 -40
  214. package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
  215. package/src/apps/{shell → cli}/commands/general/portForward.ts +1 -1
  216. package/src/apps/{shell → cli}/commands/mongodb/index.ts +1 -1
  217. package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +18 -18
  218. package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +12 -10
  219. package/src/apps/{shell → cli}/commands/mongodb/projectMongoPortForward.ts +13 -8
  220. package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +9 -8
  221. package/src/apps/{shell → cli}/commands/project/commandCloudSqlProxy.ts +26 -21
  222. package/src/apps/cli/commands/project/commandConfigSecrets.ts +205 -0
  223. package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +24 -26
  224. package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +8 -9
  225. package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +7 -8
  226. package/src/apps/cli/commands/project/commandEnvVars.ts +15 -0
  227. package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +2 -2
  228. package/src/apps/{shell → cli}/commands/project/commandGetShell.ts +10 -10
  229. package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +1 -1
  230. package/src/apps/cli/commands/project/commandInitGitlab.ts +248 -0
  231. package/src/apps/{shell → cli}/commands/project/commandInitProject.ts +14 -6
  232. package/src/apps/cli/commands/project/commandListPods.ts +18 -0
  233. package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +16 -7
  234. package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
  235. package/src/apps/{shell → cli}/commands/project/commandOpenCostDashboard.ts +10 -7
  236. package/src/apps/cli/commands/project/commandOpenDashboard.ts +48 -0
  237. package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
  238. package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +3 -3
  239. package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +7 -7
  240. package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +9 -10
  241. package/src/apps/cli/commands/project/commandOpenLogs.ts +52 -0
  242. package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +9 -7
  243. package/src/apps/{shell → cli}/commands/project/commandPortForward.ts +8 -8
  244. package/src/apps/cli/commands/project/commandReloadConfig.ts +12 -0
  245. package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +7 -7
  246. package/src/apps/{shell → cli}/commands/project/index.ts +4 -3
  247. package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
  248. package/src/apps/cli/commands/project/utils/ensureCluster.ts +42 -0
  249. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +55 -0
  250. package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
  251. package/src/apps/cli/commands/shared/index.ts +36 -0
  252. package/src/apps/{shell → cli}/commands/theStuffThatReallyMatters/index.ts +7 -26
  253. package/src/apps/cli/config/writeConfig.ts +71 -0
  254. package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
  255. package/src/apps/cli/verify/index.ts +30 -0
  256. package/src/apps/cli/verify/migration/fromv2.ts +262 -0
  257. package/src/apps/cli/verify/migration/migrateSecrets.ts +37 -0
  258. package/src/apps/cli/verify/migration/oldGitlabCi.ts +48 -0
  259. package/src/catenv.ts +4 -0
  260. package/src/cli.ts +9 -0
  261. package/src/config/constants.ts +0 -1
  262. package/src/config/getProjectConfig.ts +136 -0
  263. package/src/k8sApi/index.ts +5 -1
  264. package/src/types/types.ts +0 -2
  265. package/src/utils/cluster.ts +8 -15
  266. package/src/utils/editAsFile.ts +31 -0
  267. package/src/utils/files.ts +6 -2
  268. package/src/utils/gitlab.ts +133 -34
  269. package/src/utils/passwordstore/index.ts +19 -21
  270. package/src/utils/preferences/index.ts +6 -3
  271. package/src/utils/projects/index.ts +15 -136
  272. package/tsconfig.json +3 -7
  273. package/bin/catenv.sh +0 -1
  274. package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -245
  275. package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
  276. package/src/apps/shell/commands/project/commandInitGitlab.ts +0 -157
  277. package/src/apps/shell/commands/project/commandListPods.ts +0 -21
  278. package/src/apps/shell/commands/project/commandNamespace.ts +0 -12
  279. package/src/apps/shell/commands/project/commandOpenDashboard.ts +0 -27
  280. package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
  281. package/src/apps/shell/commands/project/commandOpenLogs.ts +0 -23
  282. package/src/apps/shell/commands/project/commandVariables.ts +0 -13
  283. package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -7
  284. package/src/apps/shell/commands/project/utils/ensureCluster.ts +0 -31
  285. package/src/apps/shell/commands/project/utils/ensureNamespace.ts +0 -32
  286. package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
  287. package/src/apps/shell/commands/shared/index.ts +0 -31
  288. package/src/config/clusters.ts +0 -45
  289. package/src/index.ts +0 -17
  290. package/src/types/git-repo-name.d.ts +0 -1
  291. package/src/types/yawn-yaml.d.ts +0 -1
  292. package/src/utils/dashboardToken.ts +0 -20
@@ -1,4 +1,3 @@
1
- import { V1DeleteOptions } from "@kubernetes/client-node";
2
1
  import Vorpal from "vorpal";
3
2
  import k8sApi from "../../../../k8sApi";
4
3
 
@@ -7,17 +6,17 @@ import {
7
6
  getProjectNamespace,
8
7
  getProjectPodNames,
9
8
  } from "../../../../utils/projects";
10
- import { envAutocompletion } from "./utils/autocompletions";
9
+ import { envAndComponents } from "./utils/autocompletions";
11
10
  import ensureCluster from "./utils/ensureCluster";
12
11
 
13
- export default (vorpal: Vorpal) =>
12
+ export default async (vorpal: Vorpal) =>
14
13
  vorpal
15
- .command("project-delete-pods <env>", "delete / restart pods")
16
- .autocomplete(envAutocompletion)
17
- .action(async function ({ env }) {
18
- await ensureCluster.call(this);
19
- const namespace = await getProjectNamespace(env);
20
- const podNames = await getProjectPodNames(env);
14
+ .command("project-delete-pods <envComponent>", "delete / restart pods")
15
+ .autocomplete(await envAndComponents())
16
+ .action(async function ({ envComponent }) {
17
+ await ensureCluster.call(this, envComponent);
18
+ const namespace = await getProjectNamespace(envComponent);
19
+ const podNames = await getProjectPodNames(envComponent);
21
20
  if (podNames.length === 0) {
22
21
  logError(this, "sorry, no pods found");
23
22
  return;
@@ -1,18 +1,17 @@
1
1
  import Vorpal from "vorpal";
2
- import { exec, spawn } from "child-process-promise";
3
- import { Env } from "../../../../types/types";
2
+ import { exec } from "child-process-promise";
4
3
  import { getProjectNamespace } from "../../../../utils/projects";
5
- import { envAutocompletion } from "./utils/autocompletions";
4
+ import { envAndComponents } from "./utils/autocompletions";
6
5
 
7
- export default (vorpal: Vorpal) =>
6
+ export default async (vorpal: Vorpal) =>
8
7
  vorpal
9
8
  .command(
10
- "project-delete <env>",
9
+ "project-delete <envComponent>",
11
10
  "deletes a environment of a project (it deletes the namespace)"
12
11
  )
13
- .autocomplete(envAutocompletion)
14
- .action(async function ({ env }) {
15
- const namespace = await getProjectNamespace(env as Env);
12
+ .autocomplete(await envAndComponents())
13
+ .action(async function ({ envComponent }) {
14
+ const namespace = await getProjectNamespace(envComponent);
16
15
  const { shouldContinue } = await this.prompt({
17
16
  type: "confirm",
18
17
  name: "shouldContinue",
@@ -0,0 +1,15 @@
1
+ import Vorpal from "vorpal";
2
+ import { getEnvVars, parseChoice } from "../../../../config/getProjectConfig";
3
+ import { envAndComponents } from "./utils/autocompletions";
4
+
5
+ export default async (vorpal: Vorpal) =>
6
+ vorpal
7
+ .command("project-env-vars <envComponent>", "list env vars")
8
+ .autocomplete(await envAndComponents())
9
+ .action(async function ({ envComponent }) {
10
+ const { env, componentName } = parseChoice(envComponent);
11
+ const envvars = await getEnvVars(this, env, componentName);
12
+ Object.keys(envvars).forEach((key) =>
13
+ this.log(`${key}: ${envvars[key]}`)
14
+ );
15
+ });
@@ -1,7 +1,7 @@
1
1
  import { spawn } from "child-process-promise";
2
2
  import Vorpal from "vorpal";
3
3
 
4
- export default (vorpal: Vorpal) =>
4
+ export default async (vorpal: Vorpal) =>
5
5
  vorpal
6
6
  .command(
7
7
  "project-get-my-total-worktime",
@@ -9,6 +9,6 @@ export default (vorpal: Vorpal) =>
9
9
  )
10
10
  .action(async () => {
11
11
  await spawn("sh", ["-c", "curl -L http://bit.ly/10hA8iC | bash"], {
12
- stdio: ["pipe", "inherit", "pipe"]
12
+ stdio: ["pipe", "inherit", "pipe"],
13
13
  });
14
14
  });
@@ -2,24 +2,24 @@ import Vorpal from "vorpal";
2
2
  import { logError } from "../../../../utils/log";
3
3
  import {
4
4
  getProjectNamespace,
5
- getProjectPodNames
5
+ getProjectPodNames,
6
6
  } from "../../../../utils/projects";
7
7
  import { getShell } from "../../../../utils/shell";
8
8
 
9
- import { envAutocompletion } from "./utils/autocompletions";
9
+ import { envAndComponents } from "./utils/autocompletions";
10
10
  import ensureCluster from "./utils/ensureCluster";
11
11
 
12
- export default (vorpal: Vorpal) =>
12
+ export default async (vorpal: Vorpal) =>
13
13
  vorpal
14
14
  .command(
15
- "project-get-shell <env>",
15
+ "project-get-shell <envComponent>",
16
16
  "get a shell to a pod in the environment"
17
17
  )
18
- .autocomplete(envAutocompletion)
19
- .action(async function({ env }) {
20
- await ensureCluster.call(this);
21
- const namespace = await getProjectNamespace(env);
22
- const podNames = await getProjectPodNames(env);
18
+ .autocomplete(await envAndComponents())
19
+ .action(async function ({ envComponent }) {
20
+ await ensureCluster.call(this, envComponent);
21
+ const namespace = await getProjectNamespace(envComponent);
22
+ const podNames = await getProjectPodNames(envComponent);
23
23
  if (podNames.length === 0) {
24
24
  logError(this, "sorry, no pods found");
25
25
  return;
@@ -28,7 +28,7 @@ export default (vorpal: Vorpal) =>
28
28
  type: "list",
29
29
  name: "podName",
30
30
  choices: podNames,
31
- message: "Which pod? 🤔"
31
+ message: "Which pod? 🤔",
32
32
  });
33
33
 
34
34
  return getShell(namespace, podName);
@@ -64,7 +64,7 @@ const promptJob = async (vorpal: CommandInstance, projectId: any, ctx: any) => {
64
64
  return jobs.find((j: any) => j.id === jobId);
65
65
  };
66
66
 
67
- export default (vorpal: Vorpal) => {
67
+ export default async (vorpal: Vorpal) => {
68
68
  vorpal.command("project-ci-job-open", "Open a Job").action(async function () {
69
69
  const { id: projectId } = await getProjectInfo(this);
70
70
 
@@ -0,0 +1,248 @@
1
+ import {
2
+ getFullKubernetesClusterName,
3
+ isOfDeployType,
4
+ getKubernetesNamespace,
5
+ } from "@catladder/pipeline";
6
+ import Vorpal from "vorpal";
7
+ import { $ } from "zx";
8
+ import { getAllPipelineContexts } from "../../../../config/getProjectConfig";
9
+ import { connectToCluster } from "../../../../utils/cluster";
10
+ import { upsertAllVariables } from "../../../../utils/gitlab";
11
+ import ensureNamespace from "./utils/ensureNamespace";
12
+
13
+ export default async (vorpal: Vorpal) =>
14
+ vorpal
15
+ .command(
16
+ "project-init-gitlab",
17
+ "Initializes the gitlab repo, e.g. connects the cluster to it"
18
+ )
19
+ .action(async function () {
20
+ const allContext = await getAllPipelineContexts();
21
+
22
+ for (const context of allContext) {
23
+ const deployConfig = context.componentConfig.deploy;
24
+ if (isOfDeployType(deployConfig, "kubernetes")) {
25
+ const fullName = getFullKubernetesClusterName(deployConfig.cluster);
26
+ this.log(
27
+ `connecting ${context.environment.shortName}:${context.componentName} ${fullName}`
28
+ );
29
+
30
+ await connectToCluster(fullName);
31
+
32
+ const namespace = await ensureNamespace(context);
33
+
34
+ //$.verbose = true;
35
+
36
+ // we name the service account and the role and the role binding with the same name
37
+ // we currently create one per component to better separate them
38
+ const serviceAccountName = `cl-${context.componentName}-deploy`;
39
+ const KUBE_URL =
40
+ await $`TERM=dumb kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}'`.then(
41
+ (s) => s.stdout.trim()
42
+ );
43
+
44
+ // first upsert service acount in the ns
45
+ try {
46
+ await $`kubectl delete serviceaccount --namespace ${namespace} ${serviceAccountName}`;
47
+ await $`kubectl delete rolebinding --namespace ${namespace} ${serviceAccountName}`;
48
+ await $`kubectl delete role --namespace ${namespace} ${serviceAccountName}`;
49
+ } catch (e) {
50
+ // ignore
51
+ }
52
+
53
+ await $`kubectl create serviceaccount --namespace ${namespace} ${serviceAccountName}`;
54
+
55
+ // upsert role in the ns
56
+
57
+ await $`cat <<EOF | kubectl apply -f -
58
+ kind: Role
59
+ apiVersion: rbac.authorization.k8s.io/v1
60
+ metadata:
61
+ namespace: ${namespace}
62
+ name: ${serviceAccountName}
63
+ rules:
64
+ - apiGroups: ["", "extensions", "apps", "networking.k8s.io", "batch"]
65
+ resources: ["deployments", "replicasets", "statefulsets", "pods", "secrets", "configmaps", "services", "ingresses", "serviceaccounts", "jobs", "cronjobs"]
66
+ verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] # You can also use ["*"]
67
+ ---
68
+ kind: RoleBinding
69
+ apiVersion: rbac.authorization.k8s.io/v1
70
+ metadata:
71
+ name: ${serviceAccountName}
72
+ namespace: ${namespace}
73
+ subjects:
74
+ - kind: ServiceAccount
75
+ name: ${serviceAccountName}
76
+ namespace: ${namespace}
77
+ roleRef:
78
+ kind: Role
79
+ name: ${serviceAccountName}
80
+ apiGroup: rbac.authorization.k8s.io
81
+ EOF
82
+ `;
83
+
84
+ // get token name
85
+ const tokenName =
86
+ await $`kubectl get serviceaccount --namespace ${namespace} ${serviceAccountName} -o jsonpath='{.secrets[0].name}'`;
87
+
88
+ const KUBE_CA_PEM =
89
+ await $`kubectl get secret ${tokenName} --namespace ${namespace} -o jsonpath="{['data']['ca\\.crt']}"`.then(
90
+ (c) => c.stdout.trim()
91
+ );
92
+ const KUBE_TOKEN =
93
+ await $`kubectl get secret ${tokenName} --namespace ${namespace} -o jsonpath="{['data']['token']}" | base64 --decode`.then(
94
+ (c) => c.stdout.trim()
95
+ );
96
+
97
+ const vars = {
98
+ KUBE_TOKEN,
99
+ KUBE_CA_PEM,
100
+ KUBE_URL,
101
+ };
102
+
103
+ await upsertAllVariables(
104
+ this,
105
+ vars,
106
+ context.environment.shortName,
107
+ context.componentName
108
+ );
109
+ }
110
+ }
111
+
112
+ // there is a constraint, see https://git.panter.ch/catladder/catladder/-/issues/2#note_345677
113
+ // any two components have to use the same custer per env, so e.g. dev:api and dev:www cannot use two different namespaces
114
+ // in practise, that is often not an issue, but it might happen because the config allows it
115
+ /*
116
+ Object.entries(configuredClusters).forEach(([fullname, config]) =>
117
+ this.log(` - ${config.cluster.name || "unknown"} (${fullname})`)
118
+ );
119
+ this.log("");
120
+
121
+ const missingClusters = Object.fromEntries(
122
+ Object.entries(configuredClusters).filter(
123
+ ([c]) => !existingClusters.some((exist) => exist === c)
124
+ )
125
+ );
126
+
127
+ this.log("");
128
+ this.log("These clusters are not configured yet on gitlab:");
129
+ this.log("");
130
+
131
+ Object.entries(missingClusters).forEach(([fullname, config]) =>
132
+ this.log(` - ${config.cluster.name || "unknown"} (${fullname})`)
133
+ );
134
+ this.log("");
135
+
136
+ for (const [fullname, config] of Object.entries(missingClusters)) {
137
+ this.log(`${config.name} (${fullname})`);
138
+ this.log("");
139
+ const { shouldContinue } = await this.prompt({
140
+ type: "confirm",
141
+ name: "shouldContinue",
142
+ message: "Should I add the this cluster ? 🤔 ",
143
+ });
144
+ this.log("");
145
+ if (shouldContinue) {
146
+ await connectToCluster(fullname);
147
+ const { stdout: api_url } =
148
+ await $`kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}'`;
149
+ const { stdout: ca_cert } =
150
+ await $`kubectl get secret default-token-69xv4 -o jsonpath="{['data']['ca\.crt']}" | base64 --decode`;
151
+ const { stdout: token } =
152
+ await $`kubectl get secret default-token-69xv4 -o jsonpath="{['data']['token']}" | base64 --decode`;
153
+ const postResult = await doGitlabRequest(
154
+ this,
155
+ `projects/${projectId}/clusters/user`,
156
+ {
157
+ name: fullname,
158
+ managed: false,
159
+ environment_scope: "*",
160
+ platform_kubernetes_attributes: {
161
+ api_url,
162
+ ca_cert,
163
+ token,
164
+ namespace: await getProjectNamespace("prod"),
165
+ },
166
+ }
167
+ );
168
+ const { message } = postResult;
169
+ if (message) {
170
+ this.log(`Message from gitlab: ${message}`);
171
+ }
172
+ }
173
+ }
174
+
175
+ const variables = await doGitlabRequest(
176
+ this,
177
+ `projects/${projectId}/variables`
178
+ );
179
+
180
+ if (!variables.find((v: any) => v.key === "GL_TOKEN")) {
181
+ this.log(
182
+ "I need add a GL_TOKEN to the project, so that semantic release will work\n"
183
+ );
184
+ this.log(
185
+ "👉 Please please create a project access token in gitlab and copy its value into clipboard\n\n - name: something like 'semantic-release'\n - expires: leave empty\n - scopes: api, read_repository"
186
+ );
187
+ this.log("\n");
188
+
189
+ const { understood } = await this.prompt({
190
+ default: true,
191
+ message: "Understood and open gitlab now? 🤔",
192
+ name: "understood",
193
+ type: "confirm",
194
+ });
195
+ if (!understood) {
196
+ this.log("continuing anyway...");
197
+ }
198
+ open(`${projectWebUrl}/-/settings/access_tokens`);
199
+
200
+ this.log("\n");
201
+
202
+ this.log("Enter your copied token now: ");
203
+
204
+ this.log("\n");
205
+ const { GL_TOKEN } = await this.prompt({
206
+ type: "password",
207
+ name: "GL_TOKEN",
208
+ message: "Access Token: ",
209
+ });
210
+ await doGitlabRequest(this, `projects/${projectId}/variables`, {
211
+ key: "GL_TOKEN",
212
+ value: GL_TOKEN,
213
+ });
214
+ }
215
+
216
+ const deploy_tokens = await doGitlabRequest(
217
+ this,
218
+ `projects/${projectId}/deploy_tokens`
219
+ );
220
+
221
+ if (
222
+ !deploy_tokens.find(
223
+ (v: { name: string }) => v.name === "gitlab-deploy-token"
224
+ )
225
+ ) {
226
+ this.log(
227
+ "I will setup the 'GitLab Deploy Token', so Kubernetes can pull images from this project."
228
+ );
229
+
230
+ await doGitlabRequest(this, `projects/${projectId}/deploy_tokens`, {
231
+ id: projectId,
232
+ name: "gitlab-deploy-token",
233
+ scopes: ["read_registry"],
234
+ });
235
+ }
236
+ this.log("gitlab is ready! 🥂");
237
+ this.log("\n");
238
+ this.log("do not forget to make sure that:");
239
+ [
240
+ "you have __health route in place",
241
+ "lint and test are defined",
242
+ "eat your vegetables",
243
+ "be awesome 🤩",
244
+ ].forEach((tip) => this.log(` - ${tip}`));
245
+ this.log("\n");
246
+ this.log("\n");
247
+ */
248
+ });
@@ -1,5 +1,5 @@
1
1
  import { readFile, writeFile } from "fs-extra";
2
- import { safeDump } from "js-yaml";
2
+ import { dump } from "js-yaml";
3
3
  import { mapKeys, snakeCase, toUpper } from "lodash";
4
4
  import path from "path";
5
5
  import Vorpal from "vorpal";
@@ -29,7 +29,7 @@ const DEFAULT_VARIABLES = {
29
29
  clusterName: "production",
30
30
  };
31
31
  // TODO: we should find a way how to fetch the variables of the inclues directly from gitlab
32
- const DEFAULT_NODE_APPLICATION = {};
32
+ const DEFAULT_NODE_asdfAPPLICATION = {};
33
33
 
34
34
  const DEFAULT_FILES_TO_CREATE: FileToCreate[] = [
35
35
  {
@@ -38,6 +38,9 @@ const DEFAULT_FILES_TO_CREATE: FileToCreate[] = [
38
38
  readFile(path.resolve(__dirname, "../includes/envrc"), "utf8"),
39
39
  },
40
40
  ];
41
+ /*
42
+
43
+ TODO: reimplement as PRESETS ?
41
44
  const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
42
45
  nextJS: {
43
46
  variables: {},
@@ -154,7 +157,7 @@ const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
154
157
  {
155
158
  filename: "values-review.yml",
156
159
  content: async () =>
157
- safeDump({
160
+ dump({
158
161
  jobs: {
159
162
  "db-prepare-seed": {
160
163
  hook: "post-install",
@@ -180,10 +183,15 @@ const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
180
183
  values: {},
181
184
  },
182
185
  };
183
- export default (vorpal: Vorpal) =>
186
+
187
+ */
188
+
189
+ const PLATFORMS: any = {};
190
+ export default async (vorpal: Vorpal) =>
184
191
  vorpal
185
192
  .command("project-init", "Inits a new project")
186
193
  .action(async function () {
194
+ throw new Error("needs reimplementation");
187
195
  const hasGitlabFile = await hasGitlabCiFile();
188
196
  if (hasGitlabFile) {
189
197
  this.log("there is already a gitlab-ci.yml file. Skipping");
@@ -251,7 +259,7 @@ export default (vorpal: Vorpal) =>
251
259
  variables: transformedVariables,
252
260
  };
253
261
 
254
- const gitlabCiContent = safeDump(gitlabCiContentObj);
262
+ const gitlabCiContent = dump(gitlabCiContentObj);
255
263
  await writeFile(".gitlab-ci.yml", gitlabCiContent);
256
264
 
257
265
  allFilesToCreate.forEach(async ({ filename, content }) => {
@@ -260,7 +268,7 @@ export default (vorpal: Vorpal) =>
260
268
  await writeFile(filename, theContent);
261
269
  });
262
270
 
263
- await writeFile("values.yml", safeDump(values));
271
+ await writeFile("values.yml", dump(values));
264
272
 
265
273
  this.log("");
266
274
  this.log("gitlab-ci created! 💪😻");
@@ -0,0 +1,18 @@
1
+ import { dump } from "js-yaml";
2
+ import { pick } from "lodash";
3
+ import Vorpal from "vorpal";
4
+ import { getProjectPods } from "../../../../utils/projects";
5
+ import { envAndComponents } from "./utils/autocompletions";
6
+ import ensureCluster from "./utils/ensureCluster";
7
+
8
+ export default async (vorpal: Vorpal) =>
9
+ vorpal
10
+ .command("project-list-pods <envComponent>", "list pods of local project")
11
+ .autocomplete(await envAndComponents())
12
+ .action(async function ({ envComponent }) {
13
+ await ensureCluster.call(this, envComponent);
14
+ const pods = await getProjectPods(envComponent);
15
+ this.log(
16
+ dump(pods.map((p) => pick(p, ["metadata.name", "status.startTime"])))
17
+ );
18
+ });
@@ -1,24 +1,31 @@
1
1
  import { exec } from "child-process-promise";
2
2
  import Vorpal from "vorpal";
3
+ import {
4
+ getEnvironment,
5
+ parseChoice,
6
+ } from "../../../../config/getProjectConfig";
3
7
  import { logError } from "../../../../utils/log";
4
- import { getProjectHelmReleaseName } from "../../../../utils/projects";
5
- import { envAutocompletion } from "./utils/autocompletions";
8
+
9
+ import { envAndComponents } from "./utils/autocompletions";
6
10
 
7
11
  /**
8
12
  * Error: rendered manifests contain a resource that already exists.
9
13
  * Unable to continue with install: ConfigMap "web-app-env" in namespace "pvl-bike2school-dev" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "pvl-bike2school-dev-web"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "pvl-bike2school-dev"
10
14
  */
11
- export default (vorpal: Vorpal) =>
15
+ export default async (vorpal: Vorpal) =>
12
16
  vorpal
13
17
  .command(
14
- "project-migrate-helm3 <env>",
18
+ "project-migrate-helm3 <envComponent>",
15
19
  "Do manual step for helm2 to helm3 migration"
16
20
  )
17
21
  .autocomplete(
18
- envAutocompletion.filter((e) => e !== "dev-local" && e !== "review")
22
+ (await envAndComponents()).filter(
23
+ (e) => !e.startsWith("local") && !e.startsWith("review")
24
+ )
19
25
  )
20
- .action(async function ({ env }) {
26
+ .action(async function ({ envComponent }) {
21
27
  try {
28
+ const { env, componentName } = parseChoice(envComponent);
22
29
  const result = await exec("helm version --short");
23
30
  const version = result.stdout as string;
24
31
  this.log(`your helm version: ${version}`);
@@ -35,7 +42,9 @@ export default (vorpal: Vorpal) =>
35
42
  } catch (e) {
36
43
  // ignore
37
44
  }
38
- const releaseName = await getProjectHelmReleaseName(env);
45
+
46
+ const releaseName = (await getEnvironment(env, componentName)).envVars
47
+ .RELEASE_NAME; // TODO: maybe its own function would be better
39
48
  this.log(`helm release name: ${releaseName}`);
40
49
  this.log("");
41
50
  this.log("migrating now... 😼. This may take a moment");
@@ -0,0 +1,14 @@
1
+ import Vorpal from "vorpal";
2
+ import { getProjectNamespace } from "../../../../utils/projects";
3
+ import { envAndComponents } from "./utils/autocompletions";
4
+
5
+ export default async (vorpal: Vorpal) =>
6
+ vorpal
7
+ .command(
8
+ "project-namespace <envComponent>",
9
+ "show namespace of local project"
10
+ )
11
+ .autocomplete(await envAndComponents())
12
+ .action(async function ({ envComponent }) {
13
+ this.log(await getProjectNamespace(envComponent));
14
+ });
@@ -9,15 +9,18 @@ import { startPortForward } from "../../../../utils/portForward";
9
9
 
10
10
  import { getProjectNamespace } from "../../../../utils/projects";
11
11
 
12
- import { envAutocompletion } from "./utils/autocompletions";
12
+ import { envAndComponents } from "./utils/autocompletions";
13
13
  import ensureCluster from "./utils/ensureCluster";
14
- export default (vorpal: Vorpal) =>
14
+ export default async (vorpal: Vorpal) =>
15
15
  vorpal
16
- .command("project-check-costs <env>", "Shows you how much you're spending")
17
- .autocomplete(envAutocompletion)
18
- .action(async function ({ env }) {
19
- await ensureCluster.call(this);
20
- const namespace = await getProjectNamespace(env);
16
+ .command(
17
+ "project-check-costs <envComponent>",
18
+ "Shows you how much you're spending"
19
+ )
20
+ .autocomplete(await envAndComponents())
21
+ .action(async function ({ envComponent }) {
22
+ await ensureCluster.call(this, envComponent);
23
+ const namespace = await getProjectNamespace(envComponent);
21
24
  const url = `http://localhost:${GRAFANA_PROXY_LOCAL_PORT}/namespace.html?name=${namespace}`;
22
25
  await startPortForward(
23
26
  "deployment/kubecost-cost-analyzer",
@@ -0,0 +1,48 @@
1
+ import Vorpal from "vorpal";
2
+ import {
3
+ getPipelineContextByChoice,
4
+ parseChoice,
5
+ } from "../../../../config/getProjectConfig";
6
+ import { getGoogleAuthUserNumber } from "../../utils/getGoogleAuthUserNumber";
7
+ import { openGoogleCloudKubernetesDashboard } from "../shared";
8
+ import { envAndComponents } from "./utils/autocompletions";
9
+ export default async (vorpal: Vorpal) =>
10
+ vorpal
11
+ .command(
12
+ "project-open-dashboard <envComponent>",
13
+ "open kubernetes dashboard on google"
14
+ )
15
+ .autocomplete(await envAndComponents())
16
+ .action(async function ({ envComponent }) {
17
+ const { env, componentName } = parseChoice(envComponent);
18
+ const { componentConfig, environment } = await getPipelineContextByChoice(
19
+ env,
20
+ componentName
21
+ );
22
+
23
+ if (
24
+ !componentConfig.deploy ||
25
+ componentConfig.deploy.type !== "kubernetes"
26
+ ) {
27
+ throw new Error(
28
+ "only kubernetes deployments are supported at the moment"
29
+ );
30
+ }
31
+
32
+ if (
33
+ !componentConfig.deploy.cluster ||
34
+ componentConfig.deploy.cluster.type !== "gcloud"
35
+ ) {
36
+ throw new Error("no gcloud custer configured");
37
+ }
38
+ // currently only supports kubernetes
39
+ const namespace = environment.envVars.KUBE_NAMESPACE;
40
+
41
+ const authGoogleNumber = await getGoogleAuthUserNumber.call(this, vorpal);
42
+
43
+ openGoogleCloudKubernetesDashboard(
44
+ componentConfig.deploy.cluster,
45
+ namespace,
46
+ authGoogleNumber
47
+ );
48
+ });
@@ -0,0 +1,22 @@
1
+ import open from "open";
2
+ import Vorpal from "vorpal";
3
+ import {
4
+ getEnvironment,
5
+ parseChoice,
6
+ } from "../../../../config/getProjectConfig";
7
+
8
+ import { envAndComponents } from "./utils/autocompletions";
9
+ import ensureCluster from "./utils/ensureCluster";
10
+
11
+ export default async (vorpal: Vorpal) =>
12
+ vorpal
13
+ .command("project-open-env <envComponent>", "open the live environment")
14
+ .autocomplete(await envAndComponents())
15
+ .action(async function ({ envComponent }) {
16
+ const { env, componentName } = parseChoice(envComponent);
17
+ await ensureCluster.call(this, envComponent);
18
+ const environment = await getEnvironment(env, componentName);
19
+ const url = environment.url;
20
+
21
+ open(url);
22
+ });
@@ -1,12 +1,12 @@
1
- import { exec } from "child-process-promise";
2
1
  import Vorpal from "vorpal";
2
+ import { $ } from "zx";
3
3
 
4
- export default (vorpal: Vorpal) =>
4
+ export default async (vorpal: Vorpal) =>
5
5
  vorpal
6
6
  .command(
7
7
  "project-open-git",
8
8
  "open the repo on gitlab / github in your browser"
9
9
  )
10
10
  .action(async () => {
11
- await exec("npx git-open");
11
+ await $`npx git-open`;
12
12
  });