@catladder/cli 0.0.0-test7 → 0.0.0-update-meteor-53480fed

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 (398) hide show
  1. package/.nvmrc +1 -1
  2. package/README.md +6 -3
  3. package/bin/catenv +3 -0
  4. package/bin/catenv-dev +3 -0
  5. package/bin/catladder +1 -1
  6. package/bin/catladder-dev +3 -0
  7. package/dist/apps/catenv/catenv.d.ts +3 -0
  8. package/dist/apps/catenv/catenv.js +66 -0
  9. package/dist/apps/catenv/catenv.js.map +1 -0
  10. package/dist/apps/catenv/printVariables.d.ts +3 -0
  11. package/dist/apps/catenv/printVariables.js +115 -0
  12. package/dist/apps/catenv/printVariables.js.map +1 -0
  13. package/dist/apps/catenv/types.d.ts +5 -0
  14. package/dist/apps/catenv/types.js +3 -0
  15. package/dist/apps/catenv/types.js.map +1 -0
  16. package/dist/apps/catenv/utils.d.ts +12 -0
  17. package/dist/apps/catenv/utils.js +108 -0
  18. package/dist/apps/catenv/utils.js.map +1 -0
  19. package/dist/apps/catenv/writeDotEnvFiles.d.ts +3 -0
  20. package/dist/apps/catenv/writeDotEnvFiles.js +94 -0
  21. package/dist/apps/catenv/writeDotEnvFiles.js.map +1 -0
  22. package/dist/apps/catenv/writeEnvDTs.d.ts +3 -0
  23. package/dist/apps/catenv/writeEnvDTs.js +114 -0
  24. package/dist/apps/catenv/writeEnvDTs.js.map +1 -0
  25. package/dist/apps/cli/cli.d.ts +2 -0
  26. package/dist/apps/cli/cli.js +83 -0
  27. package/dist/apps/cli/cli.js.map +1 -0
  28. package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.d.ts +3 -0
  29. package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js +180 -0
  30. package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +1 -0
  31. package/dist/apps/cli/commands/cloudSQL/index.d.ts +3 -0
  32. package/dist/apps/cli/commands/cloudSQL/index.js +50 -0
  33. package/dist/apps/cli/commands/cloudSQL/index.js.map +1 -0
  34. package/dist/apps/cli/commands/general/index.d.ts +4 -0
  35. package/dist/apps/cli/commands/general/index.js +216 -0
  36. package/dist/apps/cli/commands/general/index.js.map +1 -0
  37. package/dist/apps/cli/commands/general/namespaceAutoCompletion.d.ts +3 -0
  38. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js +56 -0
  39. package/dist/apps/cli/commands/general/namespaceAutoCompletion.js.map +1 -0
  40. package/dist/apps/cli/commands/general/portForward.d.ts +3 -0
  41. package/dist/apps/cli/commands/general/portForward.js +97 -0
  42. package/dist/apps/cli/commands/general/portForward.js.map +1 -0
  43. package/dist/apps/cli/commands/mongodb/index.d.ts +3 -0
  44. package/dist/apps/cli/commands/mongodb/index.js +53 -0
  45. package/dist/apps/cli/commands/mongodb/index.js.map +1 -0
  46. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +3 -0
  47. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +191 -0
  48. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -0
  49. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +3 -0
  50. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js +96 -0
  51. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js.map +1 -0
  52. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +3 -0
  53. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +121 -0
  54. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -0
  55. package/dist/apps/cli/commands/mongodb/utils/index.d.ts +13 -0
  56. package/dist/apps/cli/commands/mongodb/utils/index.js +179 -0
  57. package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -0
  58. package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +3 -0
  59. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +164 -0
  60. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
  61. package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +5 -0
  62. package/dist/apps/cli/commands/project/commandConfigSecrets.js +334 -0
  63. package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -0
  64. package/dist/apps/cli/commands/project/commandDeletePods.d.ts +3 -0
  65. package/dist/apps/cli/commands/project/commandDeletePods.js +121 -0
  66. package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -0
  67. package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +3 -0
  68. package/dist/apps/cli/commands/project/commandDeleteProject.js +97 -0
  69. package/dist/apps/cli/commands/project/commandDeleteProject.js.map +1 -0
  70. package/dist/apps/cli/commands/project/commandEnvVars.d.ts +3 -0
  71. package/dist/apps/cli/commands/project/commandEnvVars.js +74 -0
  72. package/dist/apps/cli/commands/project/commandEnvVars.js.map +1 -0
  73. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +3 -0
  74. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +58 -0
  75. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -0
  76. package/dist/apps/cli/commands/project/commandGetShell.d.ts +3 -0
  77. package/dist/apps/cli/commands/project/commandGetShell.js +96 -0
  78. package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -0
  79. package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +3 -0
  80. package/dist/apps/cli/commands/project/commandGitlabCi.js +185 -0
  81. package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -0
  82. package/dist/apps/cli/commands/project/commandInitProject.old.d.ts +3 -0
  83. package/dist/apps/cli/commands/project/commandInitProject.old.js +345 -0
  84. package/dist/apps/cli/commands/project/commandInitProject.old.js.map +1 -0
  85. package/dist/apps/cli/commands/project/commandListPods.d.ts +3 -0
  86. package/dist/apps/cli/commands/project/commandListPods.js +78 -0
  87. package/dist/apps/cli/commands/project/commandListPods.js.map +1 -0
  88. package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +7 -0
  89. package/dist/apps/cli/commands/project/commandMigrateHelm3.js +112 -0
  90. package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -0
  91. package/dist/apps/cli/commands/project/commandNamespace.d.ts +3 -0
  92. package/dist/apps/cli/commands/project/commandNamespace.js +70 -0
  93. package/dist/apps/cli/commands/project/commandNamespace.js.map +1 -0
  94. package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +3 -0
  95. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +83 -0
  96. package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -0
  97. package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +3 -0
  98. package/dist/apps/cli/commands/project/commandOpenDashboard.js +84 -0
  99. package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -0
  100. package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +3 -0
  101. package/dist/apps/cli/commands/project/commandOpenEnv.js +80 -0
  102. package/dist/apps/cli/commands/project/commandOpenEnv.js.map +1 -0
  103. package/dist/apps/cli/commands/project/commandOpenGit.d.ts +3 -0
  104. package/dist/apps/cli/commands/project/commandOpenGit.js +56 -0
  105. package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -0
  106. package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +3 -0
  107. package/dist/apps/cli/commands/project/commandOpenGrafana.js +83 -0
  108. package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -0
  109. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +3 -0
  110. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +100 -0
  111. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -0
  112. package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +3 -0
  113. package/dist/apps/cli/commands/project/commandOpenLogs.js +74 -0
  114. package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -0
  115. package/dist/apps/cli/commands/project/commandPauseProject.d.ts +3 -0
  116. package/dist/apps/cli/commands/project/commandPauseProject.js +97 -0
  117. package/dist/apps/cli/commands/project/commandPauseProject.js.map +1 -0
  118. package/dist/apps/cli/commands/project/commandPortForward.d.ts +3 -0
  119. package/dist/apps/cli/commands/project/commandPortForward.js +168 -0
  120. package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
  121. package/dist/apps/cli/commands/project/commandSecretsClearBackups.d.ts +5 -0
  122. package/dist/apps/cli/commands/project/commandSecretsClearBackups.js +90 -0
  123. package/dist/apps/cli/commands/project/commandSecretsClearBackups.js.map +1 -0
  124. package/dist/apps/cli/commands/project/commandSetup.d.ts +3 -0
  125. package/dist/apps/cli/commands/project/commandSetup.js +58 -0
  126. package/dist/apps/cli/commands/project/commandSetup.js.map +1 -0
  127. package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
  128. package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
  129. package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
  130. package/dist/apps/cli/commands/project/index.d.ts +3 -0
  131. package/dist/apps/cli/commands/project/index.js +94 -0
  132. package/dist/apps/cli/commands/project/index.js.map +1 -0
  133. package/dist/apps/cli/commands/project/setup/index.d.ts +2 -0
  134. package/dist/apps/cli/commands/project/setup/index.js +107 -0
  135. package/dist/apps/cli/commands/project/setup/index.js.map +1 -0
  136. package/dist/apps/cli/commands/project/setup/setupAccessTokens.d.ts +2 -0
  137. package/dist/apps/cli/commands/project/setup/setupAccessTokens.js +116 -0
  138. package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -0
  139. package/dist/apps/cli/commands/project/setup/setupCloudRun.d.ts +3 -0
  140. package/dist/apps/cli/commands/project/setup/setupCloudRun.js +118 -0
  141. package/dist/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -0
  142. package/dist/apps/cli/commands/project/setup/setupContext.d.ts +3 -0
  143. package/dist/apps/cli/commands/project/setup/setupContext.js +81 -0
  144. package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -0
  145. package/dist/apps/cli/commands/project/setup/setupKubernetes.d.ts +3 -0
  146. package/dist/apps/cli/commands/project/setup/setupKubernetes.js +139 -0
  147. package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -0
  148. package/dist/apps/cli/commands/project/setup/setupTopic.d.ts +2 -0
  149. package/dist/apps/cli/commands/project/setup/setupTopic.js +69 -0
  150. package/dist/apps/cli/commands/project/setup/setupTopic.js.map +1 -0
  151. package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
  152. package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
  153. package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
  154. package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +1 -0
  155. package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
  156. package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
  157. package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -0
  158. package/dist/apps/cli/commands/project/utils/ensureNamespace.js +104 -0
  159. package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
  160. package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +2 -0
  161. package/dist/apps/cli/commands/project/utils/showProjectBanner.js +58 -0
  162. package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -0
  163. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
  164. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +101 -0
  165. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
  166. package/dist/apps/cli/config/writeConfig.d.ts +5 -0
  167. package/dist/apps/cli/config/writeConfig.js +106 -0
  168. package/dist/apps/cli/config/writeConfig.js.map +1 -0
  169. package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -0
  170. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
  171. package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
  172. package/dist/apps/cli/verify/index.d.ts +2 -0
  173. package/dist/apps/cli/verify/index.js +94 -0
  174. package/dist/apps/cli/verify/index.js.map +1 -0
  175. package/dist/apps/cli/verify/migration/fromv2.d.ts +4 -0
  176. package/dist/apps/cli/verify/migration/fromv2.js +349 -0
  177. package/dist/apps/cli/verify/migration/fromv2.js.map +1 -0
  178. package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +4 -0
  179. package/dist/apps/cli/verify/migration/migrateSecrets.js +91 -0
  180. package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -0
  181. package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +18 -0
  182. package/dist/apps/cli/verify/migration/oldGitlabCi.js +30 -0
  183. package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
  184. package/dist/bundles/catenv/index.js +46512 -0
  185. package/dist/bundles/catenv/xdg-open +1066 -0
  186. package/dist/bundles/cli/clipboard_i686.exe +0 -0
  187. package/dist/bundles/cli/clipboard_x86_64.exe +0 -0
  188. package/dist/bundles/cli/exec-child.js +39 -0
  189. package/dist/bundles/cli/index.js +363134 -0
  190. package/dist/bundles/cli/xdg-open +1066 -0
  191. package/dist/bundles/cli/xsel +0 -0
  192. package/dist/catenv.d.ts +1 -0
  193. package/dist/catenv.js +13 -0
  194. package/dist/catenv.js.map +1 -0
  195. package/dist/cli.d.ts +1 -0
  196. package/dist/cli.js +8 -0
  197. package/dist/cli.js.map +1 -0
  198. package/dist/config/constants.d.ts +2 -0
  199. package/dist/config/constants.js +6 -0
  200. package/dist/config/constants.js.map +1 -0
  201. package/dist/config/getProjectConfig.d.ts +24 -0
  202. package/dist/config/getProjectConfig.js +313 -0
  203. package/dist/config/getProjectConfig.js.map +1 -0
  204. package/dist/config/parseChoice.d.ts +4 -0
  205. package/dist/config/parseChoice.js +9 -0
  206. package/dist/config/parseChoice.js.map +1 -0
  207. package/dist/gcloud/artifactsRegistry.d.ts +5 -0
  208. package/dist/gcloud/artifactsRegistry.js +59 -0
  209. package/dist/gcloud/artifactsRegistry.js.map +1 -0
  210. package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.d.ts +2 -0
  211. package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.js +67 -0
  212. package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.js.map +1 -0
  213. package/dist/gcloud/cloudRun/openCloudRunDashboards.d.ts +3 -0
  214. package/dist/gcloud/cloudRun/openCloudRunDashboards.js +62 -0
  215. package/dist/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -0
  216. package/dist/gcloud/cloudSql/startProxy.d.ts +10 -0
  217. package/dist/gcloud/cloudSql/startProxy.js +121 -0
  218. package/dist/gcloud/cloudSql/startProxy.js.map +1 -0
  219. package/dist/gcloud/enableServices.d.ts +3 -0
  220. package/dist/gcloud/enableServices.js +63 -0
  221. package/dist/gcloud/enableServices.js.map +1 -0
  222. package/dist/gcloud/openDashboard.d.ts +2 -0
  223. package/dist/gcloud/openDashboard.js +66 -0
  224. package/dist/gcloud/openDashboard.js.map +1 -0
  225. package/dist/gcloud/serviceAccounts.d.ts +12 -0
  226. package/dist/gcloud/serviceAccounts.js +144 -0
  227. package/dist/gcloud/serviceAccounts.js.map +1 -0
  228. package/dist/k8sApi/index.d.ts +8 -0
  229. package/dist/k8sApi/index.js +29 -0
  230. package/dist/k8sApi/index.js.map +1 -0
  231. package/dist/kubernetes/index.d.ts +3 -0
  232. package/dist/kubernetes/index.js +88 -0
  233. package/dist/kubernetes/index.js.map +1 -0
  234. package/dist/kubernetes/openKubernetesDashboards.d.ts +4 -0
  235. package/dist/kubernetes/openKubernetesDashboards.js +94 -0
  236. package/dist/kubernetes/openKubernetesDashboards.js.map +1 -0
  237. package/dist/kubernetes/portForward.d.ts +1 -0
  238. package/dist/kubernetes/portForward.js +55 -0
  239. package/dist/kubernetes/portForward.js.map +1 -0
  240. package/dist/packageInfos.d.ts +2 -0
  241. package/dist/packageInfos.js +6 -0
  242. package/dist/packageInfos.js.map +1 -0
  243. package/dist/tsconfig.tsbuildinfo +1 -0
  244. package/dist/types/types.d.ts +18 -0
  245. package/dist/types/types.js +3 -0
  246. package/dist/types/types.js.map +1 -0
  247. package/dist/utils/cluster.d.ts +3 -0
  248. package/dist/utils/cluster.js +68 -0
  249. package/dist/utils/cluster.js.map +1 -0
  250. package/dist/utils/editAsFile.d.ts +1 -0
  251. package/dist/utils/editAsFile.js +85 -0
  252. package/dist/utils/editAsFile.js.map +1 -0
  253. package/dist/utils/files.d.ts +2 -0
  254. package/dist/utils/files.js +83 -0
  255. package/dist/utils/files.js.map +1 -0
  256. package/dist/utils/getEditor.d.ts +4 -0
  257. package/dist/utils/getEditor.js +70 -0
  258. package/dist/utils/getEditor.js.map +1 -0
  259. package/dist/utils/gitlab.d.ts +24 -0
  260. package/dist/utils/gitlab.js +397 -0
  261. package/dist/utils/gitlab.js.map +1 -0
  262. package/dist/utils/log.d.ts +1 -0
  263. package/dist/utils/log.js +14 -0
  264. package/dist/utils/log.js.map +1 -0
  265. package/dist/utils/passwordstore/index.d.ts +7 -0
  266. package/dist/utils/passwordstore/index.js +315 -0
  267. package/dist/utils/passwordstore/index.js.map +1 -0
  268. package/dist/utils/portForwards.d.ts +12 -0
  269. package/dist/utils/portForwards.js +120 -0
  270. package/dist/utils/portForwards.js.map +1 -0
  271. package/dist/utils/preferences/index.d.ts +3 -0
  272. package/dist/utils/preferences/index.js +119 -0
  273. package/dist/utils/preferences/index.js.map +1 -0
  274. package/dist/utils/projects/index.d.ts +5 -0
  275. package/dist/utils/projects/index.js +103 -0
  276. package/dist/utils/projects/index.js.map +1 -0
  277. package/dist/utils/promise.d.ts +2 -0
  278. package/dist/utils/promise.js +62 -0
  279. package/dist/utils/promise.js.map +1 -0
  280. package/dist/utils/shell.d.ts +1 -0
  281. package/dist/utils/shell.js +81 -0
  282. package/dist/utils/shell.js.map +1 -0
  283. package/package.json +32 -35
  284. package/scripts/bundle +4 -0
  285. package/src/apps/catenv/catenv.ts +14 -37
  286. package/src/apps/catenv/printVariables.ts +58 -0
  287. package/src/apps/catenv/types.ts +6 -0
  288. package/src/apps/catenv/utils.ts +49 -0
  289. package/src/apps/catenv/writeDotEnvFiles.ts +44 -0
  290. package/src/apps/catenv/writeEnvDTs.ts +71 -0
  291. package/src/apps/{shell/shell.ts → cli/cli.ts} +13 -3
  292. package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +154 -0
  293. package/src/apps/cli/commands/cloudSQL/index.ts +8 -0
  294. package/src/apps/{shell → cli}/commands/general/index.ts +16 -52
  295. package/src/apps/{shell → cli}/commands/general/portForward.ts +7 -6
  296. package/src/apps/{shell → cli}/commands/mongodb/index.ts +2 -2
  297. package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +20 -22
  298. package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +13 -11
  299. package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +65 -0
  300. package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +28 -19
  301. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +139 -0
  302. package/src/apps/cli/commands/project/commandConfigSecrets.ts +234 -0
  303. package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +13 -15
  304. package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +8 -9
  305. package/src/apps/cli/commands/project/commandEnvVars.ts +18 -0
  306. package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +4 -4
  307. package/src/apps/cli/commands/project/commandGetShell.ts +36 -0
  308. package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +3 -2
  309. package/src/apps/{shell/commands/project/commandInitProject.ts → cli/commands/project/commandInitProject.old.ts} +15 -7
  310. package/src/apps/cli/commands/project/commandListPods.ts +18 -0
  311. package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +18 -8
  312. package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
  313. package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +32 -0
  314. package/src/apps/cli/commands/project/commandOpenDashboard.ts +28 -0
  315. package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
  316. package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +2 -2
  317. package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +10 -10
  318. package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +14 -17
  319. package/src/apps/cli/commands/project/commandOpenLogs.ts +21 -0
  320. package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +10 -8
  321. package/src/apps/cli/commands/project/commandPortForward.ts +86 -0
  322. package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +27 -0
  323. package/src/apps/cli/commands/project/commandSetup.ts +12 -0
  324. package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +13 -12
  325. package/src/apps/{shell → cli}/commands/project/index.ts +10 -10
  326. package/src/apps/cli/commands/project/setup/index.ts +44 -0
  327. package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +84 -0
  328. package/src/apps/cli/commands/project/setup/setupCloudRun.ts +84 -0
  329. package/src/apps/cli/commands/project/setup/setupContext.ts +44 -0
  330. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +140 -0
  331. package/src/apps/cli/commands/project/setup/setupTopic.ts +22 -0
  332. package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
  333. package/src/apps/cli/commands/project/utils/ensureCluster.ts +42 -0
  334. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +58 -0
  335. package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
  336. package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +32 -0
  337. package/src/apps/cli/config/writeConfig.ts +71 -0
  338. package/src/apps/cli/verify/index.ts +30 -0
  339. package/src/apps/cli/verify/migration/fromv2.ts +262 -0
  340. package/src/apps/cli/verify/migration/migrateSecrets.ts +47 -0
  341. package/src/apps/cli/verify/migration/oldGitlabCi.ts +48 -0
  342. package/src/catenv.ts +10 -0
  343. package/src/cli.ts +3 -0
  344. package/src/config/constants.ts +0 -3
  345. package/src/config/getProjectConfig.ts +200 -0
  346. package/src/config/parseChoice.ts +4 -0
  347. package/src/gcloud/artifactsRegistry.ts +16 -0
  348. package/src/gcloud/cloudRun/getCloudRunDomainSuffix.ts +35 -0
  349. package/src/gcloud/cloudRun/openCloudRunDashboards.ts +22 -0
  350. package/src/gcloud/cloudSql/startProxy.ts +74 -0
  351. package/src/gcloud/enableServices.ts +14 -0
  352. package/src/gcloud/openDashboard.ts +19 -0
  353. package/src/gcloud/serviceAccounts.ts +101 -0
  354. package/src/k8sApi/index.ts +22 -6
  355. package/src/kubernetes/index.ts +27 -0
  356. package/src/kubernetes/openKubernetesDashboards.ts +52 -0
  357. package/src/kubernetes/portForward.ts +15 -0
  358. package/src/types/child-process-promise.d.ts +37 -1
  359. package/src/types/types.ts +0 -2
  360. package/src/utils/cluster.ts +5 -14
  361. package/src/utils/editAsFile.ts +31 -0
  362. package/src/utils/files.ts +6 -2
  363. package/src/utils/gitlab.ts +263 -42
  364. package/src/utils/passwordstore/index.ts +6 -36
  365. package/src/utils/{portForward.ts → portForwards.ts} +27 -22
  366. package/src/utils/preferences/index.ts +6 -3
  367. package/src/utils/projects/index.ts +9 -149
  368. package/tsconfig.json +3 -7
  369. package/bin/catenv.sh +0 -1
  370. package/src/apps/shell/commands/mongodb/projectMongoPortForward.ts +0 -42
  371. package/src/apps/shell/commands/project/commandCloudSqlProxy.ts +0 -65
  372. package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -245
  373. package/src/apps/shell/commands/project/commandCopyDB.ts +0 -93
  374. package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
  375. package/src/apps/shell/commands/project/commandGetShell.ts +0 -35
  376. package/src/apps/shell/commands/project/commandInitGitlab.ts +0 -157
  377. package/src/apps/shell/commands/project/commandListPods.ts +0 -21
  378. package/src/apps/shell/commands/project/commandNamespace.ts +0 -12
  379. package/src/apps/shell/commands/project/commandOpenCostDashboard.ts +0 -29
  380. package/src/apps/shell/commands/project/commandOpenDashboard.ts +0 -27
  381. package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
  382. package/src/apps/shell/commands/project/commandOpenLogs.ts +0 -23
  383. package/src/apps/shell/commands/project/commandPortForward.ts +0 -45
  384. package/src/apps/shell/commands/project/commandVariables.ts +0 -13
  385. package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -7
  386. package/src/apps/shell/commands/project/utils/ensureCluster.ts +0 -31
  387. package/src/apps/shell/commands/project/utils/ensureNamespace.ts +0 -32
  388. package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
  389. package/src/apps/shell/commands/shared/index.ts +0 -31
  390. package/src/apps/shell/commands/theStuffThatReallyMatters/index.ts +0 -51
  391. package/src/config/clusters.ts +0 -45
  392. package/src/index.ts +0 -17
  393. package/src/types/git-repo-name.d.ts +0 -1
  394. package/src/types/yawn-yaml.d.ts +0 -1
  395. package/src/utils/dashboardToken.ts +0 -20
  396. package/src/utils/formatEnvVars.ts +0 -7
  397. /package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
  398. /package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
@@ -0,0 +1,103 @@
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.getProjectNamespace = exports.hasGitlabCiFile = exports.readRootGitlabCiFile = exports.getRootGitlabCiFile = exports.getGitRoot = void 0;
40
+ var path_1 = require("path");
41
+ var getProjectConfig_1 = require("../../config/getProjectConfig");
42
+ var files_1 = require("../files");
43
+ var child_process_promise_1 = require("child-process-promise");
44
+ var getGitRoot = function () { return __awaiter(void 0, void 0, void 0, function () {
45
+ return __generator(this, function (_a) {
46
+ switch (_a.label) {
47
+ case 0: return [4 /*yield*/, (0, child_process_promise_1.exec)("git rev-parse --show-toplevel")];
48
+ case 1: return [2 /*return*/, (_a.sent()).stdout.trim()];
49
+ }
50
+ });
51
+ }); };
52
+ exports.getGitRoot = getGitRoot;
53
+ var getRootGitlabCiFile = function () { return __awaiter(void 0, void 0, void 0, function () {
54
+ var gitRoot;
55
+ return __generator(this, function (_a) {
56
+ switch (_a.label) {
57
+ case 0: return [4 /*yield*/, (0, exports.getGitRoot)()];
58
+ case 1:
59
+ gitRoot = _a.sent();
60
+ return [2 /*return*/, (0, path_1.join)(gitRoot, ".gitlab-ci.yml")];
61
+ }
62
+ });
63
+ }); };
64
+ exports.getRootGitlabCiFile = getRootGitlabCiFile;
65
+ var readRootGitlabCiFile = function () { return __awaiter(void 0, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
66
+ switch (_b.label) {
67
+ case 0:
68
+ _a = files_1.readFileOrError;
69
+ return [4 /*yield*/, (0, exports.getRootGitlabCiFile)()];
70
+ case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
71
+ }
72
+ }); }); };
73
+ exports.readRootGitlabCiFile = readRootGitlabCiFile;
74
+ var hasGitlabCiFile = function () { return __awaiter(void 0, void 0, void 0, function () {
75
+ var _a, error, file;
76
+ return __generator(this, function (_b) {
77
+ switch (_b.label) {
78
+ case 0: return [4 /*yield*/, (0, exports.readRootGitlabCiFile)()];
79
+ case 1:
80
+ _a = _b.sent(), error = _a[0], file = _a[1];
81
+ if (error) {
82
+ return [2 /*return*/, false];
83
+ }
84
+ return [2 /*return*/, true];
85
+ }
86
+ });
87
+ }); };
88
+ exports.hasGitlabCiFile = hasGitlabCiFile;
89
+ var getProjectNamespace = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
90
+ var env, config;
91
+ return __generator(this, function (_a) {
92
+ switch (_a.label) {
93
+ case 0:
94
+ env = (0, getProjectConfig_1.parseChoice)(envComponent).env;
95
+ return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
96
+ case 1:
97
+ config = _a.sent();
98
+ return [2 /*return*/, "".concat(config.customerName, "-").concat(config.appName, "-").concat(env)];
99
+ }
100
+ });
101
+ }); };
102
+ exports.getProjectNamespace = getProjectNamespace;
103
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/projects/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA4B;AAC5B,kEAA8E;AAE9E,kCAA2C;AAC3C,+DAA6C;AAEtC,IAAM,UAAU,GAAG;;;oBAChB,qBAAM,IAAA,4BAAI,EAAC,+BAA+B,CAAC,EAAA;oBAAnD,sBAAO,CAAC,SAA2C,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,EAAC;;;KACpE,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"}
@@ -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,56 @@
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 build:compile && yarn build:bundle",
12
+ "build:bundle": "./scripts/bundle",
13
+ "build:compile": "yarn tsc",
14
+ "build:watch": "yarn tsc -w"
13
15
  },
14
16
  "bin": {
15
- "catladder": "./bin/catladder",
16
- "catenv": "./bin/catenv.sh"
17
+ "catenv": "./bin/catenv",
18
+ "catladder": "./bin/catladder"
17
19
  },
18
20
  "dependencies": {
19
- "@bitwarden/cli": "^1.8.0",
20
- "@kubernetes/client-node": "^0.16.1",
21
- "child-process-promise": "^2.2.1",
22
- "clipboardy": "^2.2.0",
23
- "command-exists-promise": "^2.0.2",
24
- "common-tags": "^1.8.0",
25
- "dayjs": "^1.10.4",
26
- "fs-extra": "^7.0.1",
27
- "git-repo-name": "^1.0.1",
28
- "gitlab": "^4.4.1",
29
- "js-yaml": "^3.12.0",
30
- "lodash": "^4.17.11",
31
- "memoizee": "^0.4.14",
32
- "node-fetch": "^2.3.0",
33
- "open": "^8.4.0",
34
- "open-editor": "^2.0.1",
35
- "open-in-editor": "^2.2.0",
36
- "tmp-promise": "^2.0.2",
37
- "update-notifier": "^2.5.0",
38
- "vorpal": "^1.12.0",
39
- "yargs": "^13.2.4",
40
- "yawn-yaml": "^1.3.4"
21
+ "ts-node": "^10.9.1"
41
22
  },
42
23
  "engines": {
43
24
  "node": ">=12.0.0"
44
25
  },
45
26
  "devDependencies": {
46
- "@semantic-release/git": "^10.0.1",
47
- "@semantic-release/gitlab": "^7.0.4",
27
+ "@catladder/pipeline": "0.0.0-update-meteor-53480fed",
28
+ "@kubernetes/client-node": "^0.16.2",
48
29
  "@tsconfig/node14": "^1.0.1",
49
30
  "@types/common-tags": "^1.8.0",
50
31
  "@types/fs-extra": "^5.0.4",
51
- "@types/js-yaml": "^3.11.2",
52
- "@types/lodash": "^4.14.119",
32
+ "@types/js-yaml": "^4.0.5",
33
+ "@types/lodash": "^4.14.185",
53
34
  "@types/memoizee": "^0.4.2",
54
35
  "@types/node-fetch": "^2.1.4",
55
36
  "@types/request": "^2.48.1",
37
+ "@types/tmp": "^0.2.3",
56
38
  "@types/update-notifier": "^2.5.0",
57
39
  "@types/vorpal": "^1.12.0",
58
40
  "@types/websocket": "^0.0.40",
59
41
  "@types/yargs": "^13.0.0",
60
- "@typescript-eslint/eslint-plugin": "^5.8.0",
61
- "@typescript-eslint/parser": "^5.8.0",
62
- "typescript": "^4.5.4"
42
+ "child-process-promise": "^2.2.1",
43
+ "clipboardy": "^2.0.0",
44
+ "command-exists-promise": "^2.0.2",
45
+ "common-tags": "^1.8.0",
46
+ "dayjs": "^1.10.4",
47
+ "eslint": "^8.7.0",
48
+ "fs-extra": "^7.0.1",
49
+ "gitlab": "^4.4.1",
50
+ "js-yaml": "^4.1.0",
51
+ "lodash": "^4.17.21",
52
+ "memoizee": "^0.4.14",
53
+ "node-fetch": "^2.3.0",
54
+ "open": "^8.4.0",
55
+ "prettier": "^2.5.1",
56
+ "tmp-promise": "^2.0.2",
57
+ "typescript": "^4.5.4",
58
+ "vorpal": "^1.12.0"
63
59
  },
64
- "version": "0.0.0-test7"
60
+ "version": "0.0.0-update-meteor-53480fed",
61
+ "stableVersion": "0.0.0"
65
62
  }
package/scripts/bundle ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ ncc build dist/catenv.js -o dist/bundles/catenv -e 'ts-node' $( ((SHOULD_MINIFY == 1)) && printf %s '-m')
3
+
4
+ ncc build dist/cli.js -o dist/bundles/cli -e 'ts-node' $( ((SHOULD_MINIFY == 1)) && printf %s '-m')
@@ -1,41 +1,18 @@
1
- import { getAllEnvVars } from "../../utils/projects";
2
- import {
3
- getCurrentSubApp,
4
- getSubAppsInMonoRepo,
5
- } from "../shell/commands/project/utils/monorepo";
1
+ import { getProjectConfig } from "../../config/getProjectConfig";
2
+ import { printVariables } from "./printVariables";
3
+ import type { Choice } from "./types";
4
+ import { writeDotEnvFiles } from "./writeDotEnvFiles";
5
+ import { writeDTsFiles } from "./writeEnvDTs";
6
6
 
7
- const sanitizeEnvVarName = (name: string) => name.replace(/[\s\-.]+/g, "_");
8
- export default async () => {
9
- const subapps = await getSubAppsInMonoRepo();
10
- const currentSubApp = await getCurrentSubApp();
11
- let variables = {};
12
- if (currentSubApp) {
13
- variables = await getAllEnvVars("dev-local", currentSubApp.componentName);
14
- } else if (subapps.length > 0) {
15
- // when in a monorep and not in a subapp, merge all env vars.
16
- // this is not 100% correct, but better than not exporting any vars at all
17
- // 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");
7
+ export default async (choice?: Choice) => {
8
+ const config = await getProjectConfig();
9
+ if (!config) {
10
+ return;
34
11
  }
35
12
 
36
- console.log(
37
- Object.entries(variables)
38
- .map(([key, value]) => `export ${key}='${value}'`)
39
- .join("\n")
40
- );
13
+ await printVariables(config, choice);
14
+
15
+ await writeDotEnvFiles(config, choice);
16
+
17
+ await writeDTsFiles(config, choice);
41
18
  };
@@ -0,0 +1,58 @@
1
+ import type { Config } from "@catladder/pipeline";
2
+ import { getEnvVarsResolved } from "../../config/getProjectConfig";
3
+ import type { Choice, Variables } from "./types";
4
+ import {
5
+ getCurrentComponentAndEnvFromChoice,
6
+ makeKeyValueString,
7
+ sanitizeEnvVarName,
8
+ } from "./utils";
9
+
10
+ const getAllVariablesToPrint = async (config: Config, choice?: Choice) => {
11
+ const { env, currentComponent } = await getCurrentComponentAndEnvFromChoice(
12
+ config,
13
+ choice
14
+ );
15
+
16
+ if (currentComponent) {
17
+ // don't print vars if dotenv is enabled
18
+ if (config.components[currentComponent].dotEnv) {
19
+ return {};
20
+ }
21
+ return await getEnvVarsResolved(null, env, currentComponent);
22
+ } else {
23
+ // when in a monorep and not in a subapp, merge all env vars.
24
+ // this is not 100% correct, but better than not exporting any vars at all
25
+ // so we also add prefixed variants
26
+ return await Object.keys(config.components).reduce(
27
+ async (acc, componentName) => {
28
+ // don't print vars if dotenv is enabled
29
+ if (config.components[componentName].dotEnv) {
30
+ return await acc;
31
+ }
32
+ const subappvars = await getEnvVarsResolved(null, env, componentName);
33
+ delete subappvars["_ALL_ENV_VAR_KEYS"];
34
+ return {
35
+ ...(await acc),
36
+ ...subappvars,
37
+ // also add prefixed variants in case
38
+ ...Object.fromEntries(
39
+ Object.entries(subappvars).map(([key, value]) => [
40
+ `${sanitizeEnvVarName(componentName.toUpperCase())}_${key}`,
41
+ value,
42
+ ])
43
+ ),
44
+ };
45
+ },
46
+ Promise.resolve({} as Record<string, string>)
47
+ );
48
+ }
49
+ };
50
+
51
+ export const printVariables = async (config: Config, choice?: Choice) => {
52
+ const variables = await getAllVariablesToPrint(config, choice);
53
+
54
+ console.log(makeExportKeyValuestring(variables));
55
+ };
56
+
57
+ const makeExportKeyValuestring = (variables: Variables) =>
58
+ makeKeyValueString(variables, "export ");
@@ -0,0 +1,6 @@
1
+ export type Choice = {
2
+ env?: string;
3
+ componentName?: string;
4
+ };
5
+
6
+ export type Variables = Record<string, string>;
@@ -0,0 +1,49 @@
1
+ import type { Config } from "@catladder/pipeline";
2
+ import { join } from "path";
3
+ import { getGitRoot } from "../../utils/projects";
4
+ import type { Choice, Variables } from "./types";
5
+ export const getComponentFullPath = (
6
+ gitRoot: string,
7
+ config: Config,
8
+ componentName: string
9
+ ) => {
10
+ return join(gitRoot, config.components[componentName].dir);
11
+ };
12
+ const getCurrentComponentName = async (config: Config) => {
13
+ const gitRoot = await getGitRoot();
14
+ const currentDir = process.cwd();
15
+ return Object.keys(config.components).find((c) =>
16
+ currentDir.startsWith(getComponentFullPath(gitRoot, config, c))
17
+ );
18
+ };
19
+
20
+ export const getCurrentComponentAndEnvFromChoice = async (
21
+ config: Config,
22
+ choice?: Choice
23
+ ) => {
24
+ const env = choice?.env ?? "local";
25
+ const currentComponent =
26
+ choice?.componentName ?? (await getCurrentComponentName(config));
27
+
28
+ return {
29
+ currentComponent,
30
+ env,
31
+ };
32
+ };
33
+
34
+ export const makeKeyValueString = (variables: Variables, keyPrefix = "") =>
35
+ Object.entries(variables)
36
+ .map(([key, value]) => `${keyPrefix}${key}='${value}'`)
37
+ .join("\n");
38
+
39
+ export const sanitizeMultiLine = (variables: Variables) => {
40
+ return Object.fromEntries(
41
+ Object.entries(variables).map(([key, value]) => [
42
+ key,
43
+ value.replaceAll("\n", "\\n"),
44
+ ])
45
+ );
46
+ };
47
+
48
+ export const sanitizeEnvVarName = (name: string) =>
49
+ name.replace(/[\s\-.]+/g, "_");
@@ -0,0 +1,44 @@
1
+ import type { Config } from "@catladder/pipeline";
2
+ import { writeFile } from "fs-extra";
3
+ import { join } from "path";
4
+ import { getEnvVarsResolved } from "../../config/getProjectConfig";
5
+ import { getGitRoot } from "../../utils/projects";
6
+ import type { Choice } from "./types";
7
+ import {
8
+ getComponentFullPath,
9
+ getCurrentComponentAndEnvFromChoice,
10
+ makeKeyValueString,
11
+ sanitizeMultiLine,
12
+ } from "./utils";
13
+
14
+ export const writeDotEnvFiles = async (config: Config, choice?: Choice) => {
15
+ const { env, currentComponent } = await getCurrentComponentAndEnvFromChoice(
16
+ config,
17
+ choice
18
+ );
19
+
20
+ const componentsWithEnabledDotEnvWrite = Object.entries(config.components)
21
+ .filter(([, component]) => component?.dotEnv)
22
+ .map(([componentName]) => componentName);
23
+
24
+ const componentsToActuallyWriteDotEnvNow = currentComponent
25
+ ? componentsWithEnabledDotEnvWrite.includes(currentComponent)
26
+ ? [currentComponent]
27
+ : []
28
+ : componentsWithEnabledDotEnvWrite;
29
+ const gitRoot = await getGitRoot();
30
+
31
+ for (const componentName of componentsToActuallyWriteDotEnvNow) {
32
+ const variables = await getEnvVarsResolved(null, env, componentName);
33
+ delete variables["_ALL_ENV_VAR_KEYS"];
34
+ const componentDir = getComponentFullPath(gitRoot, config, componentName);
35
+ const filePath = join(componentDir, ".env");
36
+ // many .dotenv don't like multiline values, so we sanitize them here
37
+ const variablesSanitized = sanitizeMultiLine(variables);
38
+ await writeFile(
39
+ filePath,
40
+ "# automatically created by catladder. Do not modify!\n\n" +
41
+ makeKeyValueString(variablesSanitized)
42
+ );
43
+ }
44
+ };
@@ -0,0 +1,71 @@
1
+ import type { Config } from "@catladder/pipeline";
2
+ import { writeFile } from "fs-extra";
3
+ import { join } from "path";
4
+ import { getEnvironment } from "../../config/getProjectConfig";
5
+ import { getGitRoot } from "../../utils/projects";
6
+ import type { Choice } from "./types";
7
+ import {
8
+ getComponentFullPath,
9
+ getCurrentComponentAndEnvFromChoice,
10
+ } from "./utils";
11
+
12
+ export const writeDTsFiles = async (config: Config, choice?: Choice) => {
13
+ const { env, currentComponent } = await getCurrentComponentAndEnvFromChoice(
14
+ config,
15
+ choice
16
+ );
17
+
18
+ const componentsWithEnabledEnvDTsWrite = Object.entries(config.components)
19
+ .filter(([, component]) => component?.envDTs)
20
+ .map(([componentName]) => componentName);
21
+
22
+ const componentsToActuallyWriteEnvDts = currentComponent
23
+ ? componentsWithEnabledEnvDTsWrite.includes(currentComponent)
24
+ ? [currentComponent]
25
+ : []
26
+ : componentsWithEnabledEnvDTsWrite;
27
+ const gitRoot = await getGitRoot();
28
+
29
+ for (const componentName of componentsToActuallyWriteEnvDts) {
30
+ const envNames = await getEnvsForDTs(env, componentName);
31
+ const envDTsContent = createEnvDTsContent(envNames);
32
+
33
+ const componentDir = getComponentFullPath(gitRoot, config, componentName);
34
+ const filePath = join(componentDir, "env.d.ts");
35
+ await writeFile(filePath, envDTsContent);
36
+ }
37
+ };
38
+
39
+ async function getEnvsForDTs(
40
+ env: string,
41
+ componentName: string
42
+ ): Promise<string[]> {
43
+ const environment = await getEnvironment(env, componentName);
44
+ const allEnvKeys = Object.keys(environment.envVars);
45
+ const hiddenEnvKeys = new Set(
46
+ environment.secretEnvVarKeys
47
+ .filter((s) => s.hidden)
48
+ .map((s) => s.key)
49
+ .concat(["_ALL_ENV_VAR_KEYS"])
50
+ );
51
+ const dTsEnvKeys = allEnvKeys.filter((k) => !hiddenEnvKeys.has(k));
52
+
53
+ return dTsEnvKeys;
54
+ }
55
+
56
+ function createEnvDTsContent(envNames: string[]) {
57
+ return `/* tslint:disable prettier/prettier */
58
+ /* eslint-disable prettier/prettier */
59
+ /* prettier-ignore */
60
+ // automatically generated by catladder. Do not modify!
61
+ export {}
62
+
63
+ declare global {
64
+ namespace NodeJS {
65
+ interface ProcessEnv {
66
+ ${envNames.map((name) => ` ${name}: string`).join("\n")}
67
+ }
68
+ }
69
+ }
70
+ `;
71
+ }