@catladder/cli 0.0.0-test4 → 0.0.0-updatemongo6-52a2af91

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 (304) hide show
  1. package/.nvmrc +1 -1
  2. package/README.md +6 -3
  3. package/bin/catenv +3 -0
  4. package/bin/catladder +1 -1
  5. package/dist/apps/catenv/catenv.d.ts +5 -0
  6. package/dist/apps/catenv/catenv.js +143 -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 +216 -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 +97 -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 +121 -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 +178 -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 +137 -0
  37. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
  38. package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +4 -0
  39. package/dist/apps/cli/commands/project/commandConfigSecrets.js +298 -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 +80 -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 +120 -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/commandInitProject.old.d.ts +3 -0
  63. package/dist/apps/cli/commands/project/commandInitProject.old.js +345 -0
  64. package/dist/apps/cli/commands/project/commandInitProject.old.js.map +1 -0
  65. package/dist/apps/cli/commands/project/commandListPods.d.ts +3 -0
  66. package/dist/apps/cli/commands/project/commandListPods.js +78 -0
  67. package/dist/apps/cli/commands/project/commandListPods.js.map +1 -0
  68. package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +7 -0
  69. package/dist/apps/cli/commands/project/commandMigrateHelm3.js +113 -0
  70. package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -0
  71. package/dist/apps/cli/commands/project/commandNamespace.d.ts +3 -0
  72. package/dist/apps/cli/commands/project/commandNamespace.js +70 -0
  73. package/dist/apps/cli/commands/project/commandNamespace.js.map +1 -0
  74. package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +3 -0
  75. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +83 -0
  76. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -0
  77. package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +3 -0
  78. package/dist/apps/cli/commands/project/commandOpenDashboard.js +85 -0
  79. package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -0
  80. package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +3 -0
  81. package/dist/apps/cli/commands/project/commandOpenEnv.js +80 -0
  82. package/dist/apps/cli/commands/project/commandOpenEnv.js.map +1 -0
  83. package/dist/apps/cli/commands/project/commandOpenGit.d.ts +3 -0
  84. package/dist/apps/cli/commands/project/commandOpenGit.js +61 -0
  85. package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -0
  86. package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +3 -0
  87. package/dist/apps/cli/commands/project/commandOpenGrafana.js +83 -0
  88. package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -0
  89. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +3 -0
  90. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +99 -0
  91. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -0
  92. package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +3 -0
  93. package/dist/apps/cli/commands/project/commandOpenLogs.js +87 -0
  94. package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -0
  95. package/dist/apps/cli/commands/project/commandPauseProject.d.ts +3 -0
  96. package/dist/apps/cli/commands/project/commandPauseProject.js +97 -0
  97. package/dist/apps/cli/commands/project/commandPauseProject.js.map +1 -0
  98. package/dist/apps/cli/commands/project/commandPortForward.d.ts +3 -0
  99. package/dist/apps/cli/commands/project/commandPortForward.js +106 -0
  100. package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
  101. package/dist/apps/cli/commands/project/commandSetup.d.ts +3 -0
  102. package/dist/apps/cli/commands/project/commandSetup.js +58 -0
  103. package/dist/apps/cli/commands/project/commandSetup.js.map +1 -0
  104. package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
  105. package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
  106. package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
  107. package/dist/apps/cli/commands/project/index.d.ts +3 -0
  108. package/dist/apps/cli/commands/project/index.js +94 -0
  109. package/dist/apps/cli/commands/project/index.js.map +1 -0
  110. package/dist/apps/cli/commands/project/setup/index.d.ts +2 -0
  111. package/dist/apps/cli/commands/project/setup/index.js +103 -0
  112. package/dist/apps/cli/commands/project/setup/index.js.map +1 -0
  113. package/dist/apps/cli/commands/project/setup/setupAccessTokens.d.ts +2 -0
  114. package/dist/apps/cli/commands/project/setup/setupAccessTokens.js +116 -0
  115. package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -0
  116. package/dist/apps/cli/commands/project/setup/setupContext.d.ts +3 -0
  117. package/dist/apps/cli/commands/project/setup/setupContext.js +74 -0
  118. package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -0
  119. package/dist/apps/cli/commands/project/setup/setupKubernetes.d.ts +3 -0
  120. package/dist/apps/cli/commands/project/setup/setupKubernetes.js +133 -0
  121. package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -0
  122. package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
  123. package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
  124. package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
  125. package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +1 -0
  126. package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
  127. package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
  128. package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -0
  129. package/dist/apps/cli/commands/project/utils/ensureNamespace.js +104 -0
  130. package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
  131. package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +2 -0
  132. package/dist/apps/cli/commands/project/utils/showProjectBanner.js +58 -0
  133. package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -0
  134. package/dist/apps/cli/commands/shared/index.d.ts +3 -0
  135. package/dist/apps/cli/commands/shared/index.js +70 -0
  136. package/dist/apps/cli/commands/shared/index.js.map +1 -0
  137. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
  138. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +101 -0
  139. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
  140. package/dist/apps/cli/config/writeConfig.d.ts +5 -0
  141. package/dist/apps/cli/config/writeConfig.js +106 -0
  142. package/dist/apps/cli/config/writeConfig.js.map +1 -0
  143. package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -0
  144. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
  145. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
  146. package/dist/apps/cli/verify/index.d.ts +2 -0
  147. package/dist/apps/cli/verify/index.js +94 -0
  148. package/dist/apps/cli/verify/index.js.map +1 -0
  149. package/dist/apps/cli/verify/migration/fromv2.d.ts +4 -0
  150. package/dist/apps/cli/verify/migration/fromv2.js +347 -0
  151. package/dist/apps/cli/verify/migration/fromv2.js.map +1 -0
  152. package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +4 -0
  153. package/dist/apps/cli/verify/migration/migrateSecrets.js +88 -0
  154. package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -0
  155. package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +18 -0
  156. package/dist/apps/cli/verify/migration/oldGitlabCi.js +30 -0
  157. package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
  158. package/dist/catenv.d.ts +1 -0
  159. package/dist/catenv.js +15 -0
  160. package/dist/catenv.js.map +1 -0
  161. package/dist/cli.d.ts +1 -0
  162. package/dist/cli.js +15 -0
  163. package/dist/cli.js.map +1 -0
  164. package/dist/config/constants.d.ts +2 -0
  165. package/dist/config/constants.js +6 -0
  166. package/dist/config/constants.js.map +1 -0
  167. package/dist/config/getProjectConfig.d.ts +24 -0
  168. package/dist/config/getProjectConfig.js +259 -0
  169. package/dist/config/getProjectConfig.js.map +1 -0
  170. package/dist/k8sApi/index.d.ts +8 -0
  171. package/dist/k8sApi/index.js +29 -0
  172. package/dist/k8sApi/index.js.map +1 -0
  173. package/dist/packageInfos.d.ts +2 -0
  174. package/dist/packageInfos.js +6 -0
  175. package/dist/packageInfos.js.map +1 -0
  176. package/dist/tsconfig.tsbuildinfo +1 -0
  177. package/dist/types/types.d.ts +18 -0
  178. package/dist/types/types.js +3 -0
  179. package/dist/types/types.js.map +1 -0
  180. package/dist/utils/cluster.d.ts +3 -0
  181. package/dist/utils/cluster.js +73 -0
  182. package/dist/utils/cluster.js.map +1 -0
  183. package/dist/utils/editAsFile.d.ts +1 -0
  184. package/dist/utils/editAsFile.js +85 -0
  185. package/dist/utils/editAsFile.js.map +1 -0
  186. package/dist/utils/files.d.ts +2 -0
  187. package/dist/utils/files.js +83 -0
  188. package/dist/utils/files.js.map +1 -0
  189. package/dist/utils/getEditor.d.ts +4 -0
  190. package/dist/utils/getEditor.js +70 -0
  191. package/dist/utils/getEditor.js.map +1 -0
  192. package/dist/utils/gitlab.d.ts +22 -0
  193. package/dist/utils/gitlab.js +340 -0
  194. package/dist/utils/gitlab.js.map +1 -0
  195. package/dist/utils/log.d.ts +1 -0
  196. package/dist/utils/log.js +14 -0
  197. package/dist/utils/log.js.map +1 -0
  198. package/dist/utils/passwordstore/index.d.ts +7 -0
  199. package/dist/utils/passwordstore/index.js +315 -0
  200. package/dist/utils/passwordstore/index.js.map +1 -0
  201. package/dist/utils/portForward.d.ts +4 -0
  202. package/dist/utils/portForward.js +116 -0
  203. package/dist/utils/portForward.js.map +1 -0
  204. package/dist/utils/preferences/index.d.ts +3 -0
  205. package/dist/utils/preferences/index.js +119 -0
  206. package/dist/utils/preferences/index.js.map +1 -0
  207. package/dist/utils/projects/index.d.ts +8 -0
  208. package/dist/utils/projects/index.js +154 -0
  209. package/dist/utils/projects/index.js.map +1 -0
  210. package/dist/utils/promise.d.ts +2 -0
  211. package/dist/utils/promise.js +62 -0
  212. package/dist/utils/promise.js.map +1 -0
  213. package/dist/utils/shell.d.ts +1 -0
  214. package/dist/utils/shell.js +81 -0
  215. package/dist/utils/shell.js.map +1 -0
  216. package/package.json +17 -21
  217. package/src/apps/catenv/catenv.ts +55 -27
  218. package/src/apps/{shell/shell.ts → cli/cli.ts} +10 -2
  219. package/src/apps/{shell → cli}/commands/general/index.ts +7 -46
  220. package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
  221. package/src/apps/{shell → cli}/commands/general/portForward.ts +3 -2
  222. package/src/apps/{shell → cli}/commands/mongodb/index.ts +1 -1
  223. package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +18 -18
  224. package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +12 -10
  225. package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +62 -0
  226. package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +26 -15
  227. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +88 -0
  228. package/src/apps/cli/commands/project/commandConfigSecrets.ts +200 -0
  229. package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +25 -26
  230. package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +10 -10
  231. package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +7 -8
  232. package/src/apps/cli/commands/project/commandEnvVars.ts +15 -0
  233. package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +2 -2
  234. package/src/apps/{shell → cli}/commands/project/commandGetShell.ts +10 -10
  235. package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +1 -1
  236. package/src/apps/{shell/commands/project/commandInitProject.ts → cli/commands/project/commandInitProject.old.ts} +14 -6
  237. package/src/apps/cli/commands/project/commandListPods.ts +18 -0
  238. package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +16 -7
  239. package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
  240. package/src/apps/{shell → cli}/commands/project/commandOpenCostDashboard.ts +10 -7
  241. package/src/apps/cli/commands/project/commandOpenDashboard.ts +48 -0
  242. package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
  243. package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +3 -3
  244. package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +7 -7
  245. package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +9 -10
  246. package/src/apps/cli/commands/project/commandOpenLogs.ts +52 -0
  247. package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +9 -7
  248. package/src/apps/{shell → cli}/commands/project/commandPortForward.ts +8 -8
  249. package/src/apps/cli/commands/project/commandSetup.ts +12 -0
  250. package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +10 -10
  251. package/src/apps/{shell → cli}/commands/project/index.ts +6 -7
  252. package/src/apps/cli/commands/project/setup/index.ts +42 -0
  253. package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +73 -0
  254. package/src/apps/cli/commands/project/setup/setupContext.ts +37 -0
  255. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +113 -0
  256. package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
  257. package/src/apps/cli/commands/project/utils/ensureCluster.ts +42 -0
  258. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +56 -0
  259. package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
  260. package/src/apps/cli/commands/shared/index.ts +36 -0
  261. package/src/apps/{shell → cli}/commands/theStuffThatReallyMatters/index.ts +7 -26
  262. package/src/apps/cli/config/writeConfig.ts +71 -0
  263. package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
  264. package/src/apps/cli/verify/index.ts +30 -0
  265. package/src/apps/cli/verify/migration/fromv2.ts +264 -0
  266. package/src/apps/cli/verify/migration/migrateSecrets.ts +37 -0
  267. package/src/apps/cli/verify/migration/oldGitlabCi.ts +48 -0
  268. package/src/catenv.ts +11 -0
  269. package/src/cli.ts +9 -0
  270. package/src/config/constants.ts +0 -3
  271. package/src/config/getProjectConfig.ts +160 -0
  272. package/src/k8sApi/index.ts +22 -6
  273. package/src/types/types.ts +0 -2
  274. package/src/utils/cluster.ts +6 -15
  275. package/src/utils/editAsFile.ts +31 -0
  276. package/src/utils/files.ts +6 -2
  277. package/src/utils/gitlab.ts +212 -34
  278. package/src/utils/passwordstore/index.ts +4 -34
  279. package/src/utils/preferences/index.ts +6 -3
  280. package/src/utils/projects/index.ts +22 -138
  281. package/tsconfig.json +3 -7
  282. package/bin/catenv.sh +0 -1
  283. package/src/apps/shell/commands/mongodb/projectMongoPortForward.ts +0 -42
  284. package/src/apps/shell/commands/project/commandCloudSqlProxy.ts +0 -65
  285. package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -245
  286. package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
  287. package/src/apps/shell/commands/project/commandInitGitlab.ts +0 -157
  288. package/src/apps/shell/commands/project/commandListPods.ts +0 -21
  289. package/src/apps/shell/commands/project/commandNamespace.ts +0 -12
  290. package/src/apps/shell/commands/project/commandOpenDashboard.ts +0 -27
  291. package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
  292. package/src/apps/shell/commands/project/commandOpenLogs.ts +0 -23
  293. package/src/apps/shell/commands/project/commandVariables.ts +0 -13
  294. package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -7
  295. package/src/apps/shell/commands/project/utils/ensureCluster.ts +0 -31
  296. package/src/apps/shell/commands/project/utils/ensureNamespace.ts +0 -32
  297. package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
  298. package/src/apps/shell/commands/shared/index.ts +0 -31
  299. package/src/config/clusters.ts +0 -45
  300. package/src/index.ts +0 -17
  301. package/src/types/git-repo-name.d.ts +0 -1
  302. package/src/types/yawn-yaml.d.ts +0 -1
  303. package/src/utils/dashboardToken.ts +0 -20
  304. package/src/utils/formatEnvVars.ts +0 -7
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8
+ return new (P || (P = Promise))(function (resolve, reject) {
9
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
12
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
13
+ });
14
+ };
15
+ var __generator = (this && this.__generator) || function (thisArg, body) {
16
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
17
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
18
+ function verb(n) { return function (v) { return step([n, v]); }; }
19
+ function step(op) {
20
+ if (f) throw new TypeError("Generator is already executing.");
21
+ while (_) try {
22
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
23
+ if (y = 0, t) op = [op[0] & 2, t.value];
24
+ switch (op[0]) {
25
+ case 0: case 1: t = op; break;
26
+ case 4: _.label++; return { value: op[1], done: false };
27
+ case 5: _.label++; y = op[1]; op = [0]; continue;
28
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
29
+ default:
30
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
31
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
32
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
33
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
34
+ if (t[2]) _.ops.pop();
35
+ _.trys.pop(); continue;
36
+ }
37
+ op = body.call(thisArg, _);
38
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
39
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
40
+ }
41
+ };
42
+ exports.__esModule = true;
43
+ exports.getProjectPodNames = exports.getProjectPvcs = exports.getProjectPods = exports.getProjectNamespace = exports.hasGitlabCiFile = exports.readRootGitlabCiFile = exports.getRootGitlabCiFile = exports.getGitRoot = void 0;
44
+ var zx_1 = require("zx");
45
+ var path_1 = require("path");
46
+ var getProjectConfig_1 = require("../../config/getProjectConfig");
47
+ var k8sApi_1 = require("../../k8sApi");
48
+ var files_1 = require("../files");
49
+ var getGitRoot = function () { return __awaiter(void 0, void 0, void 0, function () {
50
+ return __generator(this, function (_a) {
51
+ switch (_a.label) {
52
+ case 0: return [4 /*yield*/, (0, zx_1.$)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["git rev-parse --show-toplevel"], ["git rev-parse --show-toplevel"])))];
53
+ case 1: return [2 /*return*/, (_a.sent()).stdout.trim()];
54
+ }
55
+ });
56
+ }); };
57
+ exports.getGitRoot = getGitRoot;
58
+ var getRootGitlabCiFile = function () { return __awaiter(void 0, void 0, void 0, function () {
59
+ var gitRoot;
60
+ return __generator(this, function (_a) {
61
+ switch (_a.label) {
62
+ case 0: return [4 /*yield*/, (0, exports.getGitRoot)()];
63
+ case 1:
64
+ gitRoot = _a.sent();
65
+ return [2 /*return*/, (0, path_1.join)(gitRoot, ".gitlab-ci.yml")];
66
+ }
67
+ });
68
+ }); };
69
+ exports.getRootGitlabCiFile = getRootGitlabCiFile;
70
+ var readRootGitlabCiFile = function () { return __awaiter(void 0, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
71
+ switch (_b.label) {
72
+ case 0:
73
+ _a = files_1.readFileOrError;
74
+ return [4 /*yield*/, (0, exports.getRootGitlabCiFile)()];
75
+ case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
76
+ }
77
+ }); }); };
78
+ exports.readRootGitlabCiFile = readRootGitlabCiFile;
79
+ var hasGitlabCiFile = function () { return __awaiter(void 0, void 0, void 0, function () {
80
+ var _a, error, file;
81
+ return __generator(this, function (_b) {
82
+ switch (_b.label) {
83
+ case 0: return [4 /*yield*/, (0, exports.readRootGitlabCiFile)()];
84
+ case 1:
85
+ _a = _b.sent(), error = _a[0], file = _a[1];
86
+ if (error) {
87
+ return [2 /*return*/, false];
88
+ }
89
+ return [2 /*return*/, true];
90
+ }
91
+ });
92
+ }); };
93
+ exports.hasGitlabCiFile = hasGitlabCiFile;
94
+ var getProjectNamespace = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
95
+ var env, config;
96
+ return __generator(this, function (_a) {
97
+ switch (_a.label) {
98
+ case 0:
99
+ env = (0, getProjectConfig_1.parseChoice)(envComponent).env;
100
+ return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
101
+ case 1:
102
+ config = _a.sent();
103
+ return [2 /*return*/, "".concat(config.customerName, "-").concat(config.appName, "-").concat(env)];
104
+ }
105
+ });
106
+ }); };
107
+ exports.getProjectNamespace = getProjectNamespace;
108
+ var getProjectPods = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
109
+ var namespace, k8sApi, res, componentName;
110
+ return __generator(this, function (_a) {
111
+ switch (_a.label) {
112
+ case 0: return [4 /*yield*/, (0, exports.getProjectNamespace)(envComponent)];
113
+ case 1:
114
+ namespace = _a.sent();
115
+ k8sApi = (0, k8sApi_1.getk8sApi)();
116
+ return [4 /*yield*/, k8sApi.listNamespacedPod(namespace)];
117
+ case 2:
118
+ res = _a.sent();
119
+ componentName = (0, getProjectConfig_1.parseChoice)(envComponent).componentName;
120
+ return [2 /*return*/, res.body.items.filter(function (item) { var _a, _b; return componentName ? (_b = (_a = item.metadata) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.includes(componentName + "-") : true; })];
121
+ }
122
+ });
123
+ }); };
124
+ exports.getProjectPods = getProjectPods;
125
+ var getProjectPvcs = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
126
+ var namespace, k8sApi, res;
127
+ return __generator(this, function (_a) {
128
+ switch (_a.label) {
129
+ case 0: return [4 /*yield*/, (0, exports.getProjectNamespace)(envComponent)];
130
+ case 1:
131
+ namespace = _a.sent();
132
+ k8sApi = (0, k8sApi_1.getk8sApi)();
133
+ return [4 /*yield*/, k8sApi.listNamespacedPersistentVolumeClaim(namespace)];
134
+ case 2:
135
+ res = _a.sent();
136
+ return [2 /*return*/, res.body.items];
137
+ }
138
+ });
139
+ }); };
140
+ exports.getProjectPvcs = getProjectPvcs;
141
+ var getProjectPodNames = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
142
+ var pods;
143
+ return __generator(this, function (_a) {
144
+ switch (_a.label) {
145
+ case 0: return [4 /*yield*/, (0, exports.getProjectPods)(envComponent)];
146
+ case 1:
147
+ pods = _a.sent();
148
+ return [2 /*return*/, pods.map(function (n) { return n.metadata.name; })];
149
+ }
150
+ });
151
+ }); };
152
+ exports.getProjectPodNames = getProjectPodNames;
153
+ var templateObject_1;
154
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/projects/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yBAAuB;AACvB,6BAA4B;AAC5B,kEAA8E;AAC9E,uCAAyC;AACzC,kCAA2C;AAEpC,IAAM,UAAU,GAAG;;;oBAChB,yBAAM,MAAC,mGAAA,+BAA+B,MAAA;oBAA9C,sBAAO,CAAC,SAAsC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,EAAC;;;KAC/D,CAAC;AAFW,QAAA,UAAU,cAErB;AAEK,IAAM,mBAAmB,GAAG;;;;oBACjB,qBAAM,IAAA,kBAAU,GAAE,EAAA;;gBAA5B,OAAO,GAAG,SAAkB;gBAClC,sBAAO,IAAA,WAAI,EAAC,OAAO,EAAE,gBAAgB,CAAC,EAAC;;;KACxC,CAAC;AAHW,QAAA,mBAAmB,uBAG9B;AAEK,IAAM,oBAAoB,GAAG;;;YAClC,KAAA,uBAAe,CAAA;YAAC,qBAAM,IAAA,2BAAmB,GAAE,EAAA;gBAA3C,sBAAA,kBAAgB,SAA2B,EAAC,EAAA;;SAAA,CAAC;AADlC,QAAA,oBAAoB,wBACc;AAExC,IAAM,eAAe,GAAG;;;;oBACP,qBAAM,IAAA,4BAAoB,GAAE,EAAA;;gBAA5C,KAAgB,SAA4B,EAA3C,KAAK,QAAA,EAAE,IAAI,QAAA;gBAClB,IAAI,KAAK,EAAE;oBACT,sBAAO,KAAK,EAAC;iBACd;gBACD,sBAAO,IAAI,EAAC;;;KACb,CAAC;AANW,QAAA,eAAe,mBAM1B;AAEK,IAAM,mBAAmB,GAAG,UAAO,YAAoB;;;;;gBACpD,GAAG,GAAK,IAAA,8BAAW,EAAC,YAAY,CAAC,IAA9B,CAA+B;gBAC3B,qBAAM,IAAA,mCAAgB,GAAE,EAAA;;gBAAjC,MAAM,GAAG,SAAwB;gBACvC,sBAAO,UAAG,MAAM,CAAC,YAAY,cAAI,MAAM,CAAC,OAAO,cAAI,GAAG,CAAE,EAAC;;;KAC1D,CAAC;AAJW,QAAA,mBAAmB,uBAI9B;AAEK,IAAM,cAAc,GAAG,UAAO,YAAoB;;;;oBACrC,qBAAM,IAAA,2BAAmB,EAAC,YAAY,CAAC,EAAA;;gBAAnD,SAAS,GAAG,SAAuC;gBACnD,MAAM,GAAG,IAAA,kBAAS,GAAE,CAAC;gBACf,qBAAM,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAA;;gBAA/C,GAAG,GAAG,SAAyC;gBAE7C,aAAa,GAAK,IAAA,8BAAW,EAAC,YAAY,CAAC,cAA9B,CAA+B;gBACpD,sBAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAC,IAAI,gBAChC,OAAA,aAAa,CAAC,CAAC,CAAC,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,0CAAE,QAAQ,CAAC,aAAa,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA,EAAA,CAC1E,EAAC;;;KACH,CAAC;AATW,QAAA,cAAc,kBASzB;AAEK,IAAM,cAAc,GAAG,UAAO,YAAoB;;;;oBACrC,qBAAM,IAAA,2BAAmB,EAAC,YAAY,CAAC,EAAA;;gBAAnD,SAAS,GAAG,SAAuC;gBACnD,MAAM,GAAG,IAAA,kBAAS,GAAE,CAAC;gBACf,qBAAM,MAAM,CAAC,mCAAmC,CAAC,SAAS,CAAC,EAAA;;gBAAjE,GAAG,GAAG,SAA2D;gBAEvE,sBAAO,GAAG,CAAC,IAAI,CAAC,KAAK,EAAC;;;KACvB,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEK,IAAM,kBAAkB,GAAG,UAAO,YAAoB;;;;oBAC9C,qBAAM,IAAA,sBAAc,EAAC,YAAY,CAAC,EAAA;;gBAAzC,IAAI,GAAG,SAAkC;gBAC/C,sBAAO,IAAI,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAf,CAAe,CAAC,EAAC;;;KACzC,CAAC;AAHW,QAAA,kBAAkB,sBAG7B"}
@@ -0,0 +1,2 @@
1
+ export declare function filter<T>(arr: T[], iterator: (item: T) => Promise<boolean>): Promise<T[]>;
2
+ export declare const delay: (ms: number) => Promise<unknown>;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ exports.__esModule = true;
39
+ exports.delay = exports.filter = void 0;
40
+ function filter(arr, iterator) {
41
+ return __awaiter(this, void 0, void 0, function () {
42
+ var fail;
43
+ var _this = this;
44
+ return __generator(this, function (_a) {
45
+ switch (_a.label) {
46
+ case 0:
47
+ fail = Symbol("fail");
48
+ return [4 /*yield*/, Promise.all(arr.map(function (item) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
49
+ switch (_a.label) {
50
+ case 0: return [4 /*yield*/, iterator(item)];
51
+ case 1: return [2 /*return*/, ((_a.sent()) ? item : fail)];
52
+ }
53
+ }); }); }))];
54
+ case 1: return [2 /*return*/, (_a.sent()).filter(function (i) { return i !== fail; })];
55
+ }
56
+ });
57
+ });
58
+ }
59
+ exports.filter = filter;
60
+ var delay = function (ms) { return new Promise(function (res) { return setTimeout(res, ms); }); };
61
+ exports.delay = delay;
62
+ //# sourceMappingURL=promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promise.js","sourceRoot":"","sources":["../../src/utils/promise.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAsB,MAAM,CAC1B,GAAQ,EACR,QAAuC;;;;;;;oBAEjC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;oBACnB,qBAAM,OAAO,CAAC,GAAG,CACxB,GAAG,CAAC,GAAG,CAAC,UAAM,IAAI;;wCAAM,qBAAM,QAAQ,CAAC,IAAI,CAAC,EAAA;wCAAtB,sBAAA,CAAC,CAAC,SAAoB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAA;;iCAAA,CAAC,CAC9D,EAAA;wBAFD,sBAAQ,CAAC,SAER,CAAC,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,KAAK,IAAI,EAAV,CAAU,CAAyB,EAAC;;;;CACpD;AARD,wBAQC;AAEM,IAAM,KAAK,GAAG,UAAC,EAAU,IAAK,OAAA,IAAI,OAAO,CAAC,UAAA,GAAG,IAAI,OAAA,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,EAAnB,CAAmB,CAAC,EAAvC,CAAuC,CAAC;AAAhE,QAAA,KAAK,SAA2D"}
@@ -0,0 +1 @@
1
+ export declare const getShell: (namespace: string, podName: string) => Promise<void>;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ exports.__esModule = true;
50
+ exports.getShell = void 0;
51
+ var child_process_promise_1 = require("child-process-promise");
52
+ var getShell = function (namespace, podName) { return __awaiter(void 0, void 0, void 0, function () {
53
+ var command, e_1;
54
+ return __generator(this, function (_a) {
55
+ switch (_a.label) {
56
+ case 0:
57
+ command = "kubectl exec -it ".concat(podName, " -n ").concat(namespace, " -- /bin/sh -xc 'bash||sh'");
58
+ _a.label = 1;
59
+ case 1:
60
+ _a.trys.push([1, 3, , 4]);
61
+ return [4 /*yield*/, (0, child_process_promise_1.spawn)(command, {
62
+ stdio: "inherit",
63
+ shell: true,
64
+ env: __assign(__assign({}, process.env), { DEBUG: "" })
65
+ })];
66
+ case 2:
67
+ _a.sent();
68
+ return [3 /*break*/, 4];
69
+ case 3:
70
+ e_1 = _a.sent();
71
+ // tslint:disable-next-line:no-console
72
+ if (e_1.code !== 130) {
73
+ console.log(e_1);
74
+ }
75
+ return [3 /*break*/, 4];
76
+ case 4: return [2 /*return*/];
77
+ }
78
+ });
79
+ }); };
80
+ exports.getShell = getShell;
81
+ //# sourceMappingURL=shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA8C;AAEvC,IAAM,QAAQ,GAAG,UAAO,SAAiB,EAAE,OAAe;;;;;gBACzD,OAAO,GAAG,2BAAoB,OAAO,iBAAO,SAAS,+BAA4B,CAAC;;;;gBAEtF,qBAAM,IAAA,6BAAK,EAAC,OAAO,EAAE;wBACnB,KAAK,EAAE,SAAS;wBAChB,KAAK,EAAE,IAAI;wBACX,GAAG,wBACE,OAAO,CAAC,GAAG,KACd,KAAK,EAAE,EAAE,GACV;qBACF,CAAC,EAAA;;gBAPF,SAOE,CAAC;;;;gBAEH,sCAAsC;gBACtC,IAAI,GAAC,CAAC,IAAI,KAAK,GAAG,EAAE;oBAClB,OAAO,CAAC,GAAG,CAAC,GAAC,CAAC,CAAC;iBAChB;;;;;KAEJ,CAAC;AAjBW,QAAA,QAAQ,YAiBnB"}
package/package.json CHANGED
@@ -7,59 +7,55 @@
7
7
  "scripts": {
8
8
  "lint": "eslint \"src/**/*.ts\"",
9
9
  "lint:fix": "eslint \"src/**/*.ts\" --fix",
10
- "test": "npm run lint",
11
- "build": "tsc",
12
- "build:watch": "tsc -w"
10
+ "test": "yarn run lint",
11
+ "build": "yarn tsc",
12
+ "build:watch": "yarn tsc -w"
13
13
  },
14
14
  "bin": {
15
- "catladder": "./bin/catladder",
16
- "catenv": "./bin/catenv.sh"
15
+ "catenv": "./bin/catenv",
16
+ "catladder": "./bin/catladder"
17
17
  },
18
18
  "dependencies": {
19
- "@bitwarden/cli": "^1.8.0",
20
- "@kubernetes/client-node": "^0.16.1",
19
+ "@catladder/pipeline": "0.0.0-updatemongo6-52a2af91",
20
+ "@kubernetes/client-node": "^0.16.2",
21
21
  "child-process-promise": "^2.2.1",
22
- "clipboardy": "^2.2.0",
22
+ "clipboardy": "^2.0.0",
23
23
  "command-exists-promise": "^2.0.2",
24
24
  "common-tags": "^1.8.0",
25
25
  "dayjs": "^1.10.4",
26
26
  "fs-extra": "^7.0.1",
27
- "git-repo-name": "^1.0.1",
28
27
  "gitlab": "^4.4.1",
29
- "js-yaml": "^3.12.0",
30
- "lodash": "^4.17.11",
28
+ "js-yaml": "^4.1.0",
29
+ "lodash": "^4.17.21",
31
30
  "memoizee": "^0.4.14",
32
31
  "node-fetch": "^2.3.0",
33
32
  "open": "^8.4.0",
34
- "open-editor": "^2.0.1",
35
- "open-in-editor": "^2.2.0",
33
+ "prettier": "^2.5.1",
36
34
  "tmp-promise": "^2.0.2",
37
35
  "update-notifier": "^2.5.0",
38
36
  "vorpal": "^1.12.0",
39
- "yargs": "^13.2.4",
40
- "yawn-yaml": "^1.3.4"
37
+ "zx": "^4.3.0"
41
38
  },
42
39
  "engines": {
43
40
  "node": ">=12.0.0"
44
41
  },
45
42
  "devDependencies": {
46
- "@semantic-release/git": "^10.0.1",
47
- "@semantic-release/gitlab": "^7.0.4",
48
43
  "@tsconfig/node14": "^1.0.1",
49
44
  "@types/common-tags": "^1.8.0",
50
45
  "@types/fs-extra": "^5.0.4",
51
- "@types/js-yaml": "^3.11.2",
46
+ "@types/js-yaml": "^4.0.5",
52
47
  "@types/lodash": "^4.14.119",
53
48
  "@types/memoizee": "^0.4.2",
54
49
  "@types/node-fetch": "^2.1.4",
55
50
  "@types/request": "^2.48.1",
51
+ "@types/tmp": "^0.2.3",
56
52
  "@types/update-notifier": "^2.5.0",
57
53
  "@types/vorpal": "^1.12.0",
58
54
  "@types/websocket": "^0.0.40",
59
55
  "@types/yargs": "^13.0.0",
60
- "@typescript-eslint/eslint-plugin": "^5.8.0",
61
- "@typescript-eslint/parser": "^5.8.0",
56
+ "eslint": "^8.7.0",
62
57
  "typescript": "^4.5.4"
63
58
  },
64
- "version": "0.0.0-test4"
59
+ "version": "0.0.0-updatemongo6-52a2af91",
60
+ "stableVersion": "0.0.0"
65
61
  }
@@ -1,37 +1,65 @@
1
- import { getAllEnvVars } from "../../utils/projects";
2
- import {
3
- getCurrentSubApp,
4
- getSubAppsInMonoRepo,
5
- } from "../shell/commands/project/utils/monorepo";
1
+ import { Config, ComponentConfig } from "@catladder/pipeline";
2
+ import { getEnvVars, getProjectConfig } from "../../config/getProjectConfig";
3
+ import { getGitRoot } from "../../utils/projects";
4
+ import { join } from "path";
5
+ const getCurrentComponentName = async (
6
+ components: Record<string, ComponentConfig>
7
+ ) => {
8
+ const gitRoot = await getGitRoot();
9
+ const currentDir = process.cwd();
10
+ return Object.keys(components).find((c) =>
11
+ currentDir.startsWith(join(gitRoot, components[c].dir))
12
+ );
13
+ };
6
14
 
7
15
  const sanitizeEnvVarName = (name: string) => name.replace(/[\s\-.]+/g, "_");
8
- export default async () => {
9
- const subapps = await getSubAppsInMonoRepo();
10
- const currentSubApp = await getCurrentSubApp();
16
+
17
+ const getAllVariablesToPrint = async (
18
+ config: Config,
19
+ choice?: {
20
+ env?: string;
21
+ componentName?: string;
22
+ }
23
+ ) => {
24
+ const env = choice?.env ?? "local";
25
+ const { components } = config;
26
+
27
+ const currentComponent =
28
+ choice?.componentName ?? (await getCurrentComponentName(components));
29
+
11
30
  let variables = {};
12
- if (currentSubApp) {
13
- variables = await getAllEnvVars("dev-local", currentSubApp.componentName);
14
- } else if (subapps.length > 0) {
31
+ if (currentComponent) {
32
+ variables = await getEnvVars(null, env, currentComponent);
33
+ } else {
15
34
  // when in a monorep and not in a subapp, merge all env vars.
16
35
  // this is not 100% correct, but better than not exporting any vars at all
17
36
  // so we also add prefixed variants
18
- variables = await subapps.reduce(async (acc, subapp) => {
19
- const subappvars = await getAllEnvVars("dev-local", subapp.componentName);
20
- return {
21
- ...(await acc),
22
- ...subappvars,
23
- // also add prefixed variants in case
24
- ...Object.fromEntries(
25
- Object.entries(subappvars).map(([key, value]) => [
26
- `${sanitizeEnvVarName(subapp.componentName.toUpperCase())}_${key}`,
27
- value,
28
- ])
29
- ),
30
- };
31
- }, {});
32
- } else {
33
- variables = await getAllEnvVars("dev-local");
37
+ variables = await Object.keys(components).reduce(
38
+ async (acc, componentName) => {
39
+ const subappvars = await getEnvVars(null, env, componentName);
40
+ return {
41
+ ...(await acc),
42
+ ...subappvars,
43
+ // also add prefixed variants in case
44
+ ...Object.fromEntries(
45
+ Object.entries(subappvars).map(([key, value]) => [
46
+ `${sanitizeEnvVarName(componentName.toUpperCase())}_${key}`,
47
+ value,
48
+ ])
49
+ ),
50
+ };
51
+ },
52
+ {}
53
+ );
54
+ }
55
+ return variables;
56
+ };
57
+ export default async (choice?: { env?: string; componentName?: string }) => {
58
+ const config = await getProjectConfig();
59
+ if (!config) {
60
+ return;
34
61
  }
62
+ const variables = await getAllVariablesToPrint(config, choice);
35
63
 
36
64
  console.log(
37
65
  Object.entries(variables)
@@ -6,11 +6,15 @@ import general from "./commands/general";
6
6
  import mongodb from "./commands/mongodb";
7
7
  import project from "./commands/project";
8
8
  import theStuffThatReallyMatters from "./commands/theStuffThatReallyMatters";
9
- const welcomeMessage = `catladder 2 😻 version ${packageInfos.version}`;
10
9
 
11
- export default () => {
10
+ import { verify } from "./verify";
11
+ import { showProjectBanner } from "./commands/project/utils/showProjectBanner";
12
+
13
+ export default async () => {
12
14
  const vorpal = new Vorpal();
13
15
 
16
+ const welcomeMessage = `catladder 2022 😻 version ${packageInfos.version}`;
17
+
14
18
  vorpal
15
19
  .delimiter("catladder $") // emoji messes with cursor :-( https://github.com/dthree/vorpal/issues/332
16
20
  .history("catladder")
@@ -19,6 +23,10 @@ export default () => {
19
23
  .log(welcomeMessage)
20
24
  .log("");
21
25
 
26
+ await showProjectBanner(vorpal);
27
+
28
+ verify(vorpal);
29
+
22
30
  general(vorpal);
23
31
  project(vorpal);
24
32
  mongodb(vorpal);
@@ -1,12 +1,7 @@
1
1
  import memoizee from "memoizee";
2
2
  import Vorpal from "vorpal";
3
- import k8sApi from "../../../../k8sApi";
4
- import {
5
- connectToCluster,
6
- getAllClusterNames,
7
- getCurrentConnectedClusterName,
8
- getCurrentContext,
9
- } from "../../../../utils/cluster";
3
+ import { getk8sApi } from "../../../../k8sApi";
4
+ import { getCurrentContext } from "../../../../utils/cluster";
10
5
  import { logError } from "../../../../utils/log";
11
6
  import { syncBitwarden } from "../../../../utils/passwordstore";
12
7
  import {
@@ -14,16 +9,12 @@ import {
14
9
  stopPortForward,
15
10
  } from "../../../../utils/portForward";
16
11
  import { getShell } from "../../../../utils/shell";
17
- import { getGoogleAuthUserNumber } from "../../utils/getGoogleAuthUserNumber";
18
- import {
19
- openGoogleCloudKubernetesDashboard,
20
- openGoogleCloudLogs,
21
- } from "../shared";
22
12
  import { namespaceAutoCompletion } from "./namespaceAutoCompletion";
23
13
  import portForward from "./portForward";
24
14
 
25
15
  const getAllNamespaces = memoizee(
26
16
  async () => {
17
+ const k8sApi = getk8sApi();
27
18
  const res = await k8sApi.listNamespace();
28
19
  return res.body.items;
29
20
  },
@@ -34,14 +25,7 @@ export const getAllNamespacesNames = async () => {
34
25
  const namespaces = await getAllNamespaces();
35
26
  return namespaces.map((n) => n.metadata.name);
36
27
  };
37
- export default (vorpal: Vorpal) => {
38
- vorpal
39
- .command("connect-cluster <clustername>")
40
- .autocomplete(getAllClusterNames())
41
- .action(async function ({ clustername }) {
42
- this.log(`connecting to ${clustername}`);
43
- await connectToCluster(clustername);
44
- });
28
+ export default async (vorpal: Vorpal) => {
45
29
  vorpal.command("current-context").action(async function () {
46
30
  this.log(await getCurrentContext());
47
31
  });
@@ -57,6 +41,7 @@ export default (vorpal: Vorpal) => {
57
41
  .command("list-secrets <namespace>", "show secrets")
58
42
  .autocomplete(namespaceAutoCompletion)
59
43
  .action(async function ({ namespace }) {
44
+ const k8sApi = getk8sApi();
60
45
  const res = await k8sApi.listNamespacedSecret(namespace);
61
46
 
62
47
  this.log(res.body.items.map((n) => n.metadata.name).join("\n"));
@@ -71,6 +56,7 @@ export default (vorpal: Vorpal) => {
71
56
  .command("list-pods <namespace>", "list all pods of namespace")
72
57
  .autocomplete(namespaceAutoCompletion)
73
58
  .action(async function ({ namespace }) {
59
+ const k8sApi = getk8sApi();
74
60
  const res = await k8sApi.listNamespacedPod(namespace);
75
61
  this.log(res.body.items.map((n) => n.metadata.name).join("\n"));
76
62
  });
@@ -82,36 +68,11 @@ export default (vorpal: Vorpal) => {
82
68
  stopPortForward(name.trim());
83
69
  });
84
70
 
85
- vorpal
86
- .command("open-dashboard <namespace>", "open kubernetes dashboard")
87
- .autocomplete(namespaceAutoCompletion)
88
- .action(async function ({ namespace }) {
89
- const clustername = await getCurrentConnectedClusterName();
90
- const authGoogleNumber = await getGoogleAuthUserNumber.call(this, vorpal);
91
-
92
- await openGoogleCloudKubernetesDashboard(
93
- authGoogleNumber,
94
- clustername,
95
- namespace
96
- );
97
- });
98
- vorpal
99
- .command(
100
- "open-logs <namespace>",
101
- "open google cloud logs (stackdriver stuff)"
102
- )
103
- .autocomplete(namespaceAutoCompletion)
104
- .action(async function ({ namespace }) {
105
- const clustername = await getCurrentConnectedClusterName();
106
- const authGoogleNumber = await getGoogleAuthUserNumber.call(this, vorpal);
107
-
108
- await openGoogleCloudLogs(authGoogleNumber, clustername, namespace);
109
- });
110
-
111
71
  vorpal
112
72
  .command("get-shell <namespace>", "get a shell to a pod in the environment")
113
73
  .autocomplete(namespaceAutoCompletion)
114
74
  .action(async function ({ namespace }) {
75
+ const k8sApi = getk8sApi();
115
76
  const res = await k8sApi.listNamespacedPod(namespace);
116
77
  if (res.body.items.length === 0) {
117
78
  logError(this, "sorry, no pods found");
@@ -3,14 +3,15 @@ import { logError } from "../../../../utils/log";
3
3
 
4
4
  import { startPortForward } from "../../../../utils/portForward";
5
5
 
6
- import k8sApi from "../../../../k8sApi";
6
+ import { getk8sApi } from "../../../../k8sApi";
7
7
  import { namespaceAutoCompletion } from "./namespaceAutoCompletion";
8
8
 
9
- export default (vorpal: Vorpal) =>
9
+ export default async (vorpal: Vorpal) =>
10
10
  vorpal
11
11
  .command("port-forward <namespace>", "start port-forwarding")
12
12
  .autocomplete(namespaceAutoCompletion)
13
13
  .action(async function ({ namespace }) {
14
+ const k8sApi = getk8sApi();
14
15
  const res = await k8sApi.listNamespacedPod(namespace);
15
16
  if (res.body.items.length === 0) {
16
17
  logError(this, "sorry, no pods found");
@@ -3,7 +3,7 @@ import projectMongoDestroyMember from "./projectMongoDestroyMember";
3
3
  import projectMongoGetShell from "./projectMongoGetShell";
4
4
  import projectMongoPortForward from "./projectMongoPortForward";
5
5
 
6
- export default (vorpal: Vorpal) => {
6
+ export default async (vorpal: Vorpal) => {
7
7
  projectMongoGetShell(vorpal);
8
8
  projectMongoPortForward(vorpal);
9
9
  projectMongoDestroyMember(vorpal);