@catladder/cli 1.40.4 → 1.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/bin/catenv +1 -1
  2. package/bin/catenv-dev +3 -0
  3. package/bin/catladder +1 -1
  4. package/bin/catladder-dev +3 -0
  5. package/dist/apps/cli/commands/general/index.d.ts +1 -1
  6. package/dist/apps/cli/commands/general/portForward.d.ts +1 -1
  7. package/dist/apps/cli/commands/mongodb/index.d.ts +1 -1
  8. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +1 -1
  9. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +2 -1
  10. package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -1
  11. package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +1 -1
  12. package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +1 -1
  13. package/dist/apps/cli/commands/mongodb/utils/index.js +2 -1
  14. package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -1
  15. package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +1 -1
  16. package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +2 -1
  17. package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -1
  18. package/dist/apps/cli/commands/project/commandCopyDB.d.ts +1 -1
  19. package/dist/apps/cli/commands/project/commandDeletePods.d.ts +1 -1
  20. package/dist/apps/cli/commands/project/commandDeletePods.js +2 -1
  21. package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -1
  22. package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +1 -1
  23. package/dist/apps/cli/commands/project/commandEnvVars.d.ts +1 -1
  24. package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +1 -1
  25. package/dist/apps/cli/commands/project/commandGetShell.d.ts +1 -1
  26. package/dist/apps/cli/commands/project/commandGetShell.js +2 -1
  27. package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -1
  28. package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +1 -1
  29. package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -1
  30. package/dist/apps/cli/commands/project/commandInitProject.old.d.ts +1 -1
  31. package/dist/apps/cli/commands/project/commandListPods.d.ts +1 -1
  32. package/dist/apps/cli/commands/project/commandListPods.js +2 -2
  33. package/dist/apps/cli/commands/project/commandListPods.js.map +1 -1
  34. package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +1 -1
  35. package/dist/apps/cli/commands/project/commandNamespace.d.ts +1 -1
  36. package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +1 -1
  37. package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +1 -1
  38. package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +1 -1
  39. package/dist/apps/cli/commands/project/commandOpenGit.d.ts +1 -1
  40. package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +1 -1
  41. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +1 -1
  42. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +2 -1
  43. package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -1
  44. package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +1 -1
  45. package/dist/apps/cli/commands/project/commandPauseProject.d.ts +1 -1
  46. package/dist/apps/cli/commands/project/commandPortForward.d.ts +1 -1
  47. package/dist/apps/cli/commands/project/commandPortForward.js +2 -1
  48. package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -1
  49. package/dist/apps/cli/commands/project/commandSetup.d.ts +1 -1
  50. package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +1 -1
  51. package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -1
  52. package/dist/apps/cli/commands/project/index.d.ts +1 -1
  53. package/dist/apps/cli/commands/project/setup/index.d.ts +1 -1
  54. package/dist/apps/cli/commands/project/setup/setupAccessTokens.d.ts +1 -1
  55. package/dist/apps/cli/commands/project/setup/setupContext.d.ts +2 -2
  56. package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -1
  57. package/dist/apps/cli/commands/project/setup/setupKubernetes.d.ts +2 -2
  58. package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
  59. package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +1 -1
  60. package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
  61. package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +1 -1
  62. package/dist/apps/cli/commands/shared/index.d.ts +1 -1
  63. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +1 -1
  64. package/dist/apps/cli/config/writeConfig.d.ts +2 -2
  65. package/dist/apps/cli/verify/index.d.ts +1 -1
  66. package/dist/apps/cli/verify/migration/fromv2.d.ts +1 -1
  67. package/dist/apps/cli/verify/migration/fromv2.js.map +1 -1
  68. package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +3 -3
  69. package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -1
  70. package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +1 -1
  71. package/dist/bundles/catenv/index.js +15 -0
  72. package/dist/bundles/catenv/xdg-open +1066 -0
  73. package/dist/bundles/cli/clipboard_i686.exe +0 -0
  74. package/dist/bundles/cli/clipboard_x86_64.exe +0 -0
  75. package/dist/bundles/cli/exec-child.js +39 -0
  76. package/dist/bundles/cli/index.js +574 -0
  77. package/dist/bundles/cli/xdg-open +1066 -0
  78. package/dist/bundles/cli/xsel +0 -0
  79. package/dist/catenv.js +2 -3
  80. package/dist/catenv.js.map +1 -1
  81. package/dist/config/getProjectConfig.d.ts +3 -6
  82. package/dist/config/getProjectConfig.js +10 -6
  83. package/dist/config/getProjectConfig.js.map +1 -1
  84. package/dist/config/parseChoice.d.ts +4 -0
  85. package/dist/config/parseChoice.js +9 -0
  86. package/dist/config/parseChoice.js.map +1 -0
  87. package/dist/kubernetes/index.d.ts +3 -0
  88. package/dist/kubernetes/index.js +88 -0
  89. package/dist/kubernetes/index.js.map +1 -0
  90. package/dist/tsconfig.tsbuildinfo +1 -1
  91. package/dist/utils/gitlab.d.ts +1 -1
  92. package/dist/utils/projects/index.d.ts +0 -3
  93. package/dist/utils/projects/index.js +1 -47
  94. package/dist/utils/projects/index.js.map +1 -1
  95. package/package.json +25 -22
  96. package/scripts/bundle +4 -0
  97. package/src/apps/catenv/catenv.ts +1 -1
  98. package/src/apps/cli/commands/general/index.ts +1 -1
  99. package/src/apps/cli/commands/general/portForward.ts +1 -1
  100. package/src/apps/cli/commands/mongodb/index.ts +1 -1
  101. package/src/apps/cli/commands/mongodb/projectMongoDestroyMember.ts +3 -5
  102. package/src/apps/cli/commands/mongodb/projectMongoGetShell.ts +1 -1
  103. package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +1 -1
  104. package/src/apps/cli/commands/mongodb/utils/index.ts +2 -4
  105. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +1 -1
  106. package/src/apps/cli/commands/project/commandConfigSecrets.ts +2 -1
  107. package/src/apps/cli/commands/project/commandCopyDB.ts +1 -1
  108. package/src/apps/cli/commands/project/commandDeletePods.ts +3 -5
  109. package/src/apps/cli/commands/project/commandDeleteProject.ts +1 -1
  110. package/src/apps/cli/commands/project/commandEnvVars.ts +1 -1
  111. package/src/apps/cli/commands/project/commandGetMyTotalWorktime.ts +1 -1
  112. package/src/apps/cli/commands/project/commandGetShell.ts +3 -5
  113. package/src/apps/cli/commands/project/commandGitlabCi.ts +2 -1
  114. package/src/apps/cli/commands/project/commandInitProject.old.ts +1 -1
  115. package/src/apps/cli/commands/project/commandListPods.ts +2 -2
  116. package/src/apps/cli/commands/project/commandMigrateHelm3.ts +1 -1
  117. package/src/apps/cli/commands/project/commandNamespace.ts +1 -1
  118. package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +1 -1
  119. package/src/apps/cli/commands/project/commandOpenDashboard.ts +1 -1
  120. package/src/apps/cli/commands/project/commandOpenEnv.ts +1 -1
  121. package/src/apps/cli/commands/project/commandOpenGit.ts +1 -1
  122. package/src/apps/cli/commands/project/commandOpenGrafana.ts +1 -1
  123. package/src/apps/cli/commands/project/commandOpenGrafanaPod.ts +3 -5
  124. package/src/apps/cli/commands/project/commandOpenLogs.ts +1 -1
  125. package/src/apps/cli/commands/project/commandPauseProject.ts +1 -1
  126. package/src/apps/cli/commands/project/commandPortForward.ts +3 -5
  127. package/src/apps/cli/commands/project/commandSetup.ts +1 -1
  128. package/src/apps/cli/commands/project/commandTriggerCronjob.ts +3 -2
  129. package/src/apps/cli/commands/project/index.ts +1 -1
  130. package/src/apps/cli/commands/project/setup/index.ts +1 -1
  131. package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +1 -1
  132. package/src/apps/cli/commands/project/setup/setupContext.ts +3 -2
  133. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +3 -2
  134. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +4 -2
  135. package/src/apps/cli/commands/project/utils/showProjectBanner.ts +1 -1
  136. package/src/apps/cli/commands/shared/index.ts +1 -1
  137. package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +1 -1
  138. package/src/apps/cli/config/writeConfig.ts +2 -2
  139. package/src/apps/cli/verify/index.ts +1 -1
  140. package/src/apps/cli/verify/migration/fromv2.ts +4 -7
  141. package/src/apps/cli/verify/migration/migrateSecrets.ts +4 -3
  142. package/src/apps/cli/verify/migration/oldGitlabCi.ts +1 -1
  143. package/src/catenv.ts +1 -3
  144. package/src/config/getProjectConfig.ts +6 -8
  145. package/src/config/parseChoice.ts +4 -0
  146. package/src/kubernetes/index.ts +27 -0
  147. package/src/utils/gitlab.ts +1 -1
  148. package/src/utils/projects/index.ts +1 -25
@@ -1,10 +1,11 @@
1
- import { Config, getEnvironment } from "@catladder/pipeline";
1
+ import type { Config } from "@catladder/pipeline";
2
+ import { getEnvironment } from "@catladder/pipeline";
2
3
  import { load } from "js-yaml";
3
4
  import { pick } from "lodash";
4
- import { CommandInstance } from "vorpal";
5
+ import type { CommandInstance } from "vorpal";
5
6
  import { upsertAllVariables } from "../../../../utils/gitlab";
6
7
  import { readPass, trashItem } from "../../../../utils/passwordstore";
7
- import { LEGACY_ENVS } from "./fromv2";
8
+ import type { LEGACY_ENVS } from "./fromv2";
8
9
 
9
10
  const getPassPath = (newConfig: Config, env: string) => {
10
11
  return `${newConfig.customerName}/${newConfig.appName}/${env}/secrets.yml`;
@@ -1,4 +1,4 @@
1
- import { BuildConfig } from "@catladder/pipeline";
1
+ import type { BuildConfig } from "@catladder/pipeline";
2
2
 
3
3
  export type OldGitlabCiFile = {
4
4
  variables: {
package/src/catenv.ts CHANGED
@@ -1,11 +1,9 @@
1
1
  import catenv from "./apps/catenv/catenv";
2
2
 
3
- import { parseChoice } from "./config/getProjectConfig";
3
+ import { parseChoice } from "./config/parseChoice";
4
4
 
5
5
  const choice = process.argv[2] ? parseChoice(process.argv[2]) : null;
6
6
 
7
- console.log(process.argv, choice);
8
-
9
7
  catenv(choice).then(() => {
10
8
  // we have to exit manually, because we have some file watches
11
9
  process.exit();
@@ -1,19 +1,22 @@
1
+ import type {
2
+ Config} from "@catladder/pipeline";
1
3
  import {
2
4
  readConfigSync,
3
5
  getAllEnvs,
4
6
  getEnvironment as _getEnvironment,
5
7
  createContext,
6
- getSecretVarName,
7
- Config,
8
+ getSecretVarName
8
9
  } from "@catladder/pipeline";
9
10
 
10
- import { CommandInstance } from "vorpal";
11
+ import type { CommandInstance } from "vorpal";
11
12
  import { getAllVariables, getVariableValueByRawName } from "../utils/gitlab";
12
13
 
13
14
  import { getGitRoot } from "../utils/projects";
14
15
  import { readYaml } from "../utils/files";
15
16
  import { watch } from "fs";
16
17
 
18
+ export { parseChoice } from "./parseChoice";
19
+
17
20
  let currentConfig: Config = null;
18
21
 
19
22
  // reload the config on change
@@ -59,11 +62,6 @@ export const getProjectComponents = async () => {
59
62
  return Object.keys(config.components);
60
63
  };
61
64
 
62
- export const parseChoice = (envComponent: string) => {
63
- const [env, componentName] = envComponent.split(":").map((x) => x || null);
64
- return { env, componentName };
65
- };
66
-
67
65
  export const getPipelineContextByChoice = async (
68
66
  env: string,
69
67
  componentName: string
@@ -0,0 +1,4 @@
1
+ export const parseChoice = (envComponent: string) => {
2
+ const [env, componentName] = envComponent.split(":").map((x) => x || null);
3
+ return { env, componentName };
4
+ };
@@ -0,0 +1,27 @@
1
+ import { parseChoice } from "../config/parseChoice";
2
+ import { getk8sApi } from "../k8sApi";
3
+ import { getProjectNamespace } from "../utils/projects";
4
+
5
+ export const getProjectPods = async (envComponent: string) => {
6
+ const namespace = await getProjectNamespace(envComponent);
7
+ const k8sApi = getk8sApi();
8
+ const res = await k8sApi.listNamespacedPod(namespace);
9
+
10
+ const { componentName } = parseChoice(envComponent);
11
+ return res.body.items.filter((item) =>
12
+ componentName ? item.metadata?.name?.includes(componentName + "-") : true
13
+ );
14
+ };
15
+
16
+ export const getProjectPvcs = async (envComponent: string) => {
17
+ const namespace = await getProjectNamespace(envComponent);
18
+ const k8sApi = getk8sApi();
19
+ const res = await k8sApi.listNamespacedPersistentVolumeClaim(namespace);
20
+
21
+ return res.body.items;
22
+ };
23
+
24
+ export const getProjectPodNames = async (envComponent: string) => {
25
+ const pods = await getProjectPods(envComponent);
26
+ return pods.map((n) => n.metadata.name);
27
+ };
@@ -4,7 +4,7 @@ import { has, isObject, times } from "lodash";
4
4
  import memoizee from "memoizee";
5
5
  import fetch from "node-fetch";
6
6
  import open from "open";
7
- import { CommandInstance } from "vorpal";
7
+ import type { CommandInstance } from "vorpal";
8
8
  import { getPreference, hasPreference, setPreference } from "./preferences";
9
9
 
10
10
  const TOKEN_KEY = "gitlab-personal-access-token";
@@ -1,6 +1,6 @@
1
1
  import { join } from "path";
2
2
  import { getProjectConfig, parseChoice } from "../../config/getProjectConfig";
3
- import { getk8sApi } from "../../k8sApi";
3
+
4
4
  import { readFileOrError } from "../files";
5
5
  import { exec } from "child-process-promise";
6
6
 
@@ -29,27 +29,3 @@ export const getProjectNamespace = async (envComponent: string) => {
29
29
  const config = await getProjectConfig();
30
30
  return `${config.customerName}-${config.appName}-${env}`;
31
31
  };
32
-
33
- export const getProjectPods = async (envComponent: string) => {
34
- const namespace = await getProjectNamespace(envComponent);
35
- const k8sApi = getk8sApi();
36
- const res = await k8sApi.listNamespacedPod(namespace);
37
-
38
- const { componentName } = parseChoice(envComponent);
39
- return res.body.items.filter((item) =>
40
- componentName ? item.metadata?.name?.includes(componentName + "-") : true
41
- );
42
- };
43
-
44
- export const getProjectPvcs = async (envComponent: string) => {
45
- const namespace = await getProjectNamespace(envComponent);
46
- const k8sApi = getk8sApi();
47
- const res = await k8sApi.listNamespacedPersistentVolumeClaim(namespace);
48
-
49
- return res.body.items;
50
- };
51
-
52
- export const getProjectPodNames = async (envComponent: string) => {
53
- const pods = await getProjectPods(envComponent);
54
- return pods.map((n) => n.metadata.name);
55
- };