@catladder/cli 1.40.4 → 1.41.2

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 (153) 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/check.js +28 -0
  74. package/dist/bundles/cli/clipboard_i686.exe +0 -0
  75. package/dist/bundles/cli/clipboard_x86_64.exe +0 -0
  76. package/dist/bundles/cli/exec-child.js +39 -0
  77. package/dist/bundles/cli/index.js +536 -0
  78. package/dist/bundles/cli/xdg-open +1066 -0
  79. package/dist/bundles/cli/xsel +0 -0
  80. package/dist/catenv.js +2 -3
  81. package/dist/catenv.js.map +1 -1
  82. package/dist/config/getProjectConfig.d.ts +3 -6
  83. package/dist/config/getProjectConfig.js +10 -6
  84. package/dist/config/getProjectConfig.js.map +1 -1
  85. package/dist/config/parseChoice.d.ts +4 -0
  86. package/dist/config/parseChoice.js +9 -0
  87. package/dist/config/parseChoice.js.map +1 -0
  88. package/dist/kubernetes/index.d.ts +3 -0
  89. package/dist/kubernetes/index.js +88 -0
  90. package/dist/kubernetes/index.js.map +1 -0
  91. package/dist/tsconfig.tsbuildinfo +1 -1
  92. package/dist/utils/cluster.d.ts +2 -2
  93. package/dist/utils/gitlab.d.ts +1 -1
  94. package/dist/utils/passwordstore/index.js.map +1 -1
  95. package/dist/utils/projects/index.d.ts +0 -3
  96. package/dist/utils/projects/index.js +1 -47
  97. package/dist/utils/projects/index.js.map +1 -1
  98. package/package.json +25 -22
  99. package/scripts/bundle +4 -0
  100. package/src/apps/catenv/catenv.ts +1 -1
  101. package/src/apps/cli/commands/general/index.ts +1 -1
  102. package/src/apps/cli/commands/general/portForward.ts +1 -1
  103. package/src/apps/cli/commands/mongodb/index.ts +1 -1
  104. package/src/apps/cli/commands/mongodb/projectMongoDestroyMember.ts +3 -5
  105. package/src/apps/cli/commands/mongodb/projectMongoGetShell.ts +1 -1
  106. package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +1 -1
  107. package/src/apps/cli/commands/mongodb/utils/index.ts +2 -4
  108. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +1 -1
  109. package/src/apps/cli/commands/project/commandConfigSecrets.ts +2 -1
  110. package/src/apps/cli/commands/project/commandCopyDB.ts +1 -1
  111. package/src/apps/cli/commands/project/commandDeletePods.ts +3 -5
  112. package/src/apps/cli/commands/project/commandDeleteProject.ts +1 -1
  113. package/src/apps/cli/commands/project/commandEnvVars.ts +1 -1
  114. package/src/apps/cli/commands/project/commandGetMyTotalWorktime.ts +1 -1
  115. package/src/apps/cli/commands/project/commandGetShell.ts +3 -5
  116. package/src/apps/cli/commands/project/commandGitlabCi.ts +2 -1
  117. package/src/apps/cli/commands/project/commandInitProject.old.ts +1 -1
  118. package/src/apps/cli/commands/project/commandListPods.ts +2 -2
  119. package/src/apps/cli/commands/project/commandMigrateHelm3.ts +1 -1
  120. package/src/apps/cli/commands/project/commandNamespace.ts +1 -1
  121. package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +1 -1
  122. package/src/apps/cli/commands/project/commandOpenDashboard.ts +1 -1
  123. package/src/apps/cli/commands/project/commandOpenEnv.ts +1 -1
  124. package/src/apps/cli/commands/project/commandOpenGit.ts +1 -1
  125. package/src/apps/cli/commands/project/commandOpenGrafana.ts +1 -1
  126. package/src/apps/cli/commands/project/commandOpenGrafanaPod.ts +3 -5
  127. package/src/apps/cli/commands/project/commandOpenLogs.ts +1 -1
  128. package/src/apps/cli/commands/project/commandPauseProject.ts +1 -1
  129. package/src/apps/cli/commands/project/commandPortForward.ts +3 -5
  130. package/src/apps/cli/commands/project/commandSetup.ts +1 -1
  131. package/src/apps/cli/commands/project/commandTriggerCronjob.ts +3 -2
  132. package/src/apps/cli/commands/project/index.ts +1 -1
  133. package/src/apps/cli/commands/project/setup/index.ts +1 -1
  134. package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +1 -1
  135. package/src/apps/cli/commands/project/setup/setupContext.ts +3 -2
  136. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +6 -6
  137. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +4 -2
  138. package/src/apps/cli/commands/project/utils/showProjectBanner.ts +1 -1
  139. package/src/apps/cli/commands/shared/index.ts +1 -1
  140. package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +1 -1
  141. package/src/apps/cli/config/writeConfig.ts +2 -2
  142. package/src/apps/cli/verify/index.ts +1 -1
  143. package/src/apps/cli/verify/migration/fromv2.ts +4 -7
  144. package/src/apps/cli/verify/migration/migrateSecrets.ts +4 -3
  145. package/src/apps/cli/verify/migration/oldGitlabCi.ts +1 -1
  146. package/src/catenv.ts +1 -3
  147. package/src/config/getProjectConfig.ts +6 -8
  148. package/src/config/parseChoice.ts +4 -0
  149. package/src/kubernetes/index.ts +27 -0
  150. package/src/types/child-process-promise.d.ts +36 -1
  151. package/src/utils/gitlab.ts +1 -1
  152. package/src/utils/passwordstore/index.ts +2 -2
  153. package/src/utils/projects/index.ts +1 -25
@@ -1,6 +1,6 @@
1
1
  import { spawn } from "child-process-promise";
2
2
  import fetch from "node-fetch";
3
- import Vorpal from "vorpal";
3
+ import type Vorpal from "vorpal";
4
4
 
5
5
  export default async (vorpal: Vorpal) => {
6
6
  vorpal.command("dadjoke", "something for jonas.").action(async function () {
@@ -1,9 +1,9 @@
1
- import { Config } from "@catladder/pipeline";
1
+ import type { Config } from "@catladder/pipeline";
2
2
  import { spawn, exec } from "child-process-promise";
3
3
  import { writeFile } from "fs-extra";
4
4
  import { dump } from "js-yaml";
5
5
  import { format } from "prettier";
6
- import { CommandInstance } from "vorpal";
6
+ import type { CommandInstance } from "vorpal";
7
7
  import { getGitRoot } from "../../../utils/projects";
8
8
 
9
9
  export const writeConfig = async (
@@ -1,4 +1,4 @@
1
- import Vorpal from "vorpal";
1
+ import type Vorpal from "vorpal";
2
2
  import {
3
3
  getGitlabCi,
4
4
  getProjectConfig,
@@ -1,4 +1,4 @@
1
- import {
1
+ import type {
2
2
  BuildConfig,
3
3
  ComponentConfig,
4
4
  Config,
@@ -14,7 +14,7 @@ import {
14
14
  } from "fs-extra";
15
15
  import { isEmpty } from "lodash";
16
16
  import { join } from "path";
17
- import Vorpal from "vorpal";
17
+ import type Vorpal from "vorpal";
18
18
  import {
19
19
  getGitlabCi,
20
20
  getGitlabCiFilePath,
@@ -24,11 +24,8 @@ import { syncBitwarden } from "../../../../utils/passwordstore";
24
24
  import { getGitRoot } from "../../../../utils/projects";
25
25
  import { writeConfig } from "../../config/writeConfig";
26
26
  import { migrateSecrets } from "./migrateSecrets";
27
- import {
28
- detectBuildConfig,
29
- isOldInclude,
30
- OldGitlabCiFile,
31
- } from "./oldGitlabCi";
27
+ import type { OldGitlabCiFile } from "./oldGitlabCi";
28
+ import { detectBuildConfig, isOldInclude } from "./oldGitlabCi";
32
29
  export const LEGACY_ENVS = [
33
30
  "dev-local",
34
31
  "dev",
@@ -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
+ };
@@ -1 +1,36 @@
1
- declare module 'child-process-promise'
1
+ import type { ReadStream } from "fs-extra";
2
+
3
+ declare module "child-process-promise" {
4
+ function exec(
5
+ cmd: string,
6
+ options?: {
7
+ env?: Record<string, string>;
8
+ }
9
+ ): Promise<{
10
+ stdout: string;
11
+ }>;
12
+
13
+ type Stdio = "inherit" | "pipe";
14
+ type SpawnOptions = {
15
+ stdio?: Stdio | Stdio[];
16
+ shell?: boolean;
17
+ env?: Record<string, string>;
18
+ };
19
+
20
+ function spawn(
21
+ cmd: string,
22
+ options?: SpawnOptions
23
+ ): Promise<{
24
+ stdout: string;
25
+ }>;
26
+
27
+ function spawn(
28
+ cmd: string,
29
+ args: string[],
30
+ options?: SpawnOptions
31
+ ): Promise<unknown> & {
32
+ childProcess: {
33
+ stdout: ReadStream;
34
+ };
35
+ };
36
+ }
@@ -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";
@@ -15,7 +15,7 @@ const unlockBitwarden = async () => {
15
15
  let session = null;
16
16
  promise.childProcess.stdout.on(
17
17
  "data",
18
- (d: any) => (session = d.toString("utf-8"))
18
+ (d) => (session = d.toString("utf-8"))
19
19
  );
20
20
  await promise;
21
21
  await setPreference("bwsession", session);
@@ -30,7 +30,7 @@ const loginBitwarden = async () => {
30
30
  let session = null;
31
31
  promise.childProcess.stdout.on(
32
32
  "data",
33
- (d: any) => (session = d.toString("utf-8"))
33
+ (d) => (session = d.toString("utf-8"))
34
34
  );
35
35
  await promise;
36
36
  await setPreference("bwsession", session);
@@ -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
- };