@catladder/cli 0.0.0-test7 → 0.0.0-waitfor-deploy-e64a33ba
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.
- package/.nvmrc +1 -1
- package/README.md +6 -3
- package/bin/catenv +3 -0
- package/bin/catladder +1 -1
- package/dist/apps/catenv/catenv.d.ts +5 -0
- package/dist/apps/catenv/catenv.js +143 -0
- package/dist/apps/catenv/catenv.js.map +1 -0
- package/dist/apps/cli/cli.d.ts +2 -0
- package/dist/apps/cli/cli.js +81 -0
- package/dist/apps/cli/cli.js.map +1 -0
- package/dist/apps/cli/commands/general/index.d.ts +4 -0
- package/dist/apps/cli/commands/general/index.js +216 -0
- package/dist/apps/cli/commands/general/index.js.map +1 -0
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.d.ts +3 -0
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.js +56 -0
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.js.map +1 -0
- package/dist/apps/cli/commands/general/portForward.d.ts +3 -0
- package/dist/apps/cli/commands/general/portForward.js +97 -0
- package/dist/apps/cli/commands/general/portForward.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/index.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/index.js +53 -0
- package/dist/apps/cli/commands/mongodb/index.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +190 -0
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js +96 -0
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +3 -0
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +105 -0
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -0
- package/dist/apps/cli/commands/mongodb/utils/index.d.ts +13 -0
- package/dist/apps/cli/commands/mongodb/utils/index.js +167 -0
- package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +137 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +4 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js +320 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -0
- package/dist/apps/cli/commands/project/commandCopyDB.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandCopyDB.js +102 -0
- package/dist/apps/cli/commands/project/commandCopyDB.js.map +1 -0
- package/dist/apps/cli/commands/project/commandDeletePods.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandDeletePods.js +120 -0
- package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -0
- package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandDeleteProject.js +97 -0
- package/dist/apps/cli/commands/project/commandDeleteProject.js.map +1 -0
- package/dist/apps/cli/commands/project/commandEnvVars.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandEnvVars.js +74 -0
- package/dist/apps/cli/commands/project/commandEnvVars.js.map +1 -0
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +58 -0
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -0
- package/dist/apps/cli/commands/project/commandGetShell.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandGetShell.js +92 -0
- package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -0
- package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandGitlabCi.js +185 -0
- package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -0
- package/dist/apps/cli/commands/project/commandInitProject.old.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandInitProject.old.js +345 -0
- package/dist/apps/cli/commands/project/commandInitProject.old.js.map +1 -0
- package/dist/apps/cli/commands/project/commandListPods.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandListPods.js +78 -0
- package/dist/apps/cli/commands/project/commandListPods.js.map +1 -0
- package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +7 -0
- package/dist/apps/cli/commands/project/commandMigrateHelm3.js +113 -0
- package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -0
- package/dist/apps/cli/commands/project/commandNamespace.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandNamespace.js +70 -0
- package/dist/apps/cli/commands/project/commandNamespace.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +83 -0
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenDashboard.js +85 -0
- package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenEnv.js +80 -0
- package/dist/apps/cli/commands/project/commandOpenEnv.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenGit.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenGit.js +61 -0
- package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenGrafana.js +83 -0
- package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +99 -0
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -0
- package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandOpenLogs.js +87 -0
- package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -0
- package/dist/apps/cli/commands/project/commandPauseProject.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandPauseProject.js +97 -0
- package/dist/apps/cli/commands/project/commandPauseProject.js.map +1 -0
- package/dist/apps/cli/commands/project/commandPortForward.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandPortForward.js +106 -0
- package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
- package/dist/apps/cli/commands/project/commandSetup.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandSetup.js +58 -0
- package/dist/apps/cli/commands/project/commandSetup.js.map +1 -0
- package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandTriggerCronjob.js +144 -0
- package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -0
- package/dist/apps/cli/commands/project/index.d.ts +3 -0
- package/dist/apps/cli/commands/project/index.js +94 -0
- package/dist/apps/cli/commands/project/index.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/index.d.ts +2 -0
- package/dist/apps/cli/commands/project/setup/index.js +103 -0
- package/dist/apps/cli/commands/project/setup/index.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.d.ts +2 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js +115 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupContext.d.ts +3 -0
- package/dist/apps/cli/commands/project/setup/setupContext.js +74 -0
- package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.d.ts +3 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.js +132 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +3 -0
- package/dist/apps/cli/commands/project/utils/autocompletions.js +96 -0
- package/dist/apps/cli/commands/project/utils/autocompletions.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +1 -0
- package/dist/apps/cli/commands/project/utils/ensureCluster.js +84 -0
- package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js +104 -0
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -0
- package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +2 -0
- package/dist/apps/cli/commands/project/utils/showProjectBanner.js +58 -0
- package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +1 -0
- package/dist/apps/cli/commands/shared/index.d.ts +3 -0
- package/dist/apps/cli/commands/shared/index.js +70 -0
- package/dist/apps/cli/commands/shared/index.js.map +1 -0
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +3 -0
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +101 -0
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -0
- package/dist/apps/cli/config/writeConfig.d.ts +5 -0
- package/dist/apps/cli/config/writeConfig.js +106 -0
- package/dist/apps/cli/config/writeConfig.js.map +1 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +1 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +69 -0
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -0
- package/dist/apps/cli/verify/index.d.ts +2 -0
- package/dist/apps/cli/verify/index.js +94 -0
- package/dist/apps/cli/verify/index.js.map +1 -0
- package/dist/apps/cli/verify/migration/fromv2.d.ts +4 -0
- package/dist/apps/cli/verify/migration/fromv2.js +347 -0
- package/dist/apps/cli/verify/migration/fromv2.js.map +1 -0
- package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +4 -0
- package/dist/apps/cli/verify/migration/migrateSecrets.js +88 -0
- package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +18 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.js +30 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -0
- package/dist/catenv.d.ts +1 -0
- package/dist/catenv.js +15 -0
- package/dist/catenv.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +15 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/constants.d.ts +3 -0
- package/dist/config/constants.js +7 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/getProjectConfig.d.ts +24 -0
- package/dist/config/getProjectConfig.js +259 -0
- package/dist/config/getProjectConfig.js.map +1 -0
- package/dist/k8sApi/index.d.ts +8 -0
- package/dist/k8sApi/index.js +29 -0
- package/dist/k8sApi/index.js.map +1 -0
- package/dist/packageInfos.d.ts +2 -0
- package/dist/packageInfos.js +6 -0
- package/dist/packageInfos.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/types.d.ts +18 -0
- package/dist/types/types.js +3 -0
- package/dist/types/types.js.map +1 -0
- package/dist/utils/cluster.d.ts +3 -0
- package/dist/utils/cluster.js +73 -0
- package/dist/utils/cluster.js.map +1 -0
- package/dist/utils/editAsFile.d.ts +1 -0
- package/dist/utils/editAsFile.js +85 -0
- package/dist/utils/editAsFile.js.map +1 -0
- package/dist/utils/files.d.ts +2 -0
- package/dist/utils/files.js +83 -0
- package/dist/utils/files.js.map +1 -0
- package/dist/utils/getEditor.d.ts +4 -0
- package/dist/utils/getEditor.js +70 -0
- package/dist/utils/getEditor.js.map +1 -0
- package/dist/utils/gitlab.d.ts +22 -0
- package/dist/utils/gitlab.js +278 -0
- package/dist/utils/gitlab.js.map +1 -0
- package/dist/utils/log.d.ts +1 -0
- package/dist/utils/log.js +14 -0
- package/dist/utils/log.js.map +1 -0
- package/dist/utils/passwordstore/index.d.ts +8 -0
- package/dist/utils/passwordstore/index.js +378 -0
- package/dist/utils/passwordstore/index.js.map +1 -0
- package/dist/utils/portForward.d.ts +4 -0
- package/dist/utils/portForward.js +116 -0
- package/dist/utils/portForward.js.map +1 -0
- package/dist/utils/preferences/index.d.ts +3 -0
- package/dist/utils/preferences/index.js +119 -0
- package/dist/utils/preferences/index.js.map +1 -0
- package/dist/utils/projects/index.d.ts +8 -0
- package/dist/utils/projects/index.js +153 -0
- package/dist/utils/projects/index.js.map +1 -0
- package/dist/utils/promise.d.ts +2 -0
- package/dist/utils/promise.js +62 -0
- package/dist/utils/promise.js.map +1 -0
- package/dist/utils/shell.d.ts +1 -0
- package/dist/utils/shell.js +81 -0
- package/dist/utils/shell.js.map +1 -0
- package/package.json +16 -21
- package/src/apps/catenv/catenv.ts +55 -27
- package/src/apps/{shell/shell.ts → cli/cli.ts} +10 -2
- package/src/apps/{shell → cli}/commands/general/index.ts +7 -46
- package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
- package/src/apps/{shell → cli}/commands/general/portForward.ts +3 -2
- package/src/apps/{shell → cli}/commands/mongodb/index.ts +1 -1
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +18 -18
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +12 -10
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoPortForward.ts +13 -8
- package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +9 -8
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +88 -0
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +220 -0
- package/src/apps/{shell → cli}/commands/project/commandCopyDB.ts +24 -26
- package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +10 -10
- package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +7 -8
- package/src/apps/cli/commands/project/commandEnvVars.ts +15 -0
- package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +2 -2
- package/src/apps/{shell → cli}/commands/project/commandGetShell.ts +10 -10
- package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +1 -1
- package/src/apps/{shell/commands/project/commandInitProject.ts → cli/commands/project/commandInitProject.old.ts} +14 -6
- package/src/apps/cli/commands/project/commandListPods.ts +18 -0
- package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +16 -7
- package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
- package/src/apps/{shell → cli}/commands/project/commandOpenCostDashboard.ts +10 -7
- package/src/apps/cli/commands/project/commandOpenDashboard.ts +48 -0
- package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
- package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +3 -3
- package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +7 -7
- package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +9 -10
- package/src/apps/cli/commands/project/commandOpenLogs.ts +52 -0
- package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +9 -7
- package/src/apps/{shell → cli}/commands/project/commandPortForward.ts +8 -8
- package/src/apps/cli/commands/project/commandSetup.ts +12 -0
- package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +10 -10
- package/src/apps/{shell → cli}/commands/project/index.ts +6 -7
- package/src/apps/cli/commands/project/setup/index.ts +42 -0
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +72 -0
- package/src/apps/cli/commands/project/setup/setupContext.ts +37 -0
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +112 -0
- package/src/apps/cli/commands/project/utils/autocompletions.ts +26 -0
- package/src/apps/cli/commands/project/utils/ensureCluster.ts +42 -0
- package/src/apps/cli/commands/project/utils/ensureNamespace.ts +56 -0
- package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
- package/src/apps/cli/commands/shared/index.ts +36 -0
- package/src/apps/{shell → cli}/commands/theStuffThatReallyMatters/index.ts +7 -26
- package/src/apps/cli/config/writeConfig.ts +71 -0
- package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
- package/src/apps/cli/verify/index.ts +30 -0
- package/src/apps/cli/verify/migration/fromv2.ts +264 -0
- package/src/apps/cli/verify/migration/migrateSecrets.ts +37 -0
- package/src/apps/cli/verify/migration/oldGitlabCi.ts +48 -0
- package/src/catenv.ts +11 -0
- package/src/cli.ts +9 -0
- package/src/config/constants.ts +0 -1
- package/src/config/getProjectConfig.ts +160 -0
- package/src/k8sApi/index.ts +22 -6
- package/src/types/types.ts +0 -2
- package/src/utils/cluster.ts +6 -15
- package/src/utils/editAsFile.ts +31 -0
- package/src/utils/files.ts +6 -2
- package/src/utils/gitlab.ts +144 -34
- package/src/utils/passwordstore/index.ts +19 -21
- package/src/utils/preferences/index.ts +6 -3
- package/src/utils/projects/index.ts +18 -137
- package/tsconfig.json +3 -7
- package/bin/catenv.sh +0 -1
- package/src/apps/shell/commands/project/commandCloudSqlProxy.ts +0 -65
- package/src/apps/shell/commands/project/commandConfigSecrets.ts +0 -245
- package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
- package/src/apps/shell/commands/project/commandInitGitlab.ts +0 -157
- package/src/apps/shell/commands/project/commandListPods.ts +0 -21
- package/src/apps/shell/commands/project/commandNamespace.ts +0 -12
- package/src/apps/shell/commands/project/commandOpenDashboard.ts +0 -27
- package/src/apps/shell/commands/project/commandOpenEnv.ts +0 -18
- package/src/apps/shell/commands/project/commandOpenLogs.ts +0 -23
- package/src/apps/shell/commands/project/commandVariables.ts +0 -13
- package/src/apps/shell/commands/project/utils/autocompletions.ts +0 -7
- package/src/apps/shell/commands/project/utils/ensureCluster.ts +0 -31
- package/src/apps/shell/commands/project/utils/ensureNamespace.ts +0 -32
- package/src/apps/shell/commands/project/utils/monorepo.ts +0 -45
- package/src/apps/shell/commands/shared/index.ts +0 -31
- package/src/config/clusters.ts +0 -45
- package/src/index.ts +0 -17
- package/src/types/git-repo-name.d.ts +0 -1
- package/src/types/yawn-yaml.d.ts +0 -1
- package/src/utils/dashboardToken.ts +0 -20
- package/src/utils/formatEnvVars.ts +0 -7
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
exports.__esModule = true;
|
|
53
|
+
exports.setPreference = exports.getPreference = exports.hasPreference = void 0;
|
|
54
|
+
var fs_extra_1 = __importDefault(require("fs-extra"));
|
|
55
|
+
var os_1 = require("os");
|
|
56
|
+
var js_yaml_1 = require("js-yaml");
|
|
57
|
+
var directory = "".concat((0, os_1.homedir)(), "/.catladder");
|
|
58
|
+
var file = "".concat(directory, "/preferences.yml");
|
|
59
|
+
var getPreferences = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
60
|
+
var _a;
|
|
61
|
+
var _b;
|
|
62
|
+
return __generator(this, function (_c) {
|
|
63
|
+
switch (_c.label) {
|
|
64
|
+
case 0: return [4 /*yield*/, fs_extra_1["default"].pathExists(file)];
|
|
65
|
+
case 1:
|
|
66
|
+
if (!!(_c.sent())) return [3 /*break*/, 3];
|
|
67
|
+
return [4 /*yield*/, fs_extra_1["default"].createFile(file)];
|
|
68
|
+
case 2:
|
|
69
|
+
_c.sent();
|
|
70
|
+
_c.label = 3;
|
|
71
|
+
case 3:
|
|
72
|
+
_a = js_yaml_1.load;
|
|
73
|
+
return [4 /*yield*/, fs_extra_1["default"].readFile(file, { encoding: "utf-8" })];
|
|
74
|
+
case 4: return [2 /*return*/, ((_b = _a.apply(void 0, [_c.sent()])) !== null && _b !== void 0 ? _b : {})];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}); };
|
|
78
|
+
var hasPreference = function (key) { return __awaiter(void 0, void 0, void 0, function () {
|
|
79
|
+
var preferences;
|
|
80
|
+
return __generator(this, function (_a) {
|
|
81
|
+
switch (_a.label) {
|
|
82
|
+
case 0: return [4 /*yield*/, getPreferences()];
|
|
83
|
+
case 1:
|
|
84
|
+
preferences = _a.sent();
|
|
85
|
+
return [2 /*return*/, key in preferences];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}); };
|
|
89
|
+
exports.hasPreference = hasPreference;
|
|
90
|
+
var getPreference = function (key) { return __awaiter(void 0, void 0, void 0, function () {
|
|
91
|
+
var preferences;
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0: return [4 /*yield*/, getPreferences()];
|
|
95
|
+
case 1:
|
|
96
|
+
preferences = _a.sent();
|
|
97
|
+
return [2 /*return*/, preferences[key]];
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}); };
|
|
101
|
+
exports.getPreference = getPreference;
|
|
102
|
+
var setPreference = function (key, value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
103
|
+
var preferences, newPreferences;
|
|
104
|
+
var _a;
|
|
105
|
+
return __generator(this, function (_b) {
|
|
106
|
+
switch (_b.label) {
|
|
107
|
+
case 0: return [4 /*yield*/, getPreferences()];
|
|
108
|
+
case 1:
|
|
109
|
+
preferences = _b.sent();
|
|
110
|
+
newPreferences = __assign(__assign({}, preferences), (_a = {}, _a[key] = value, _a));
|
|
111
|
+
return [4 /*yield*/, fs_extra_1["default"].writeFile(file, (0, js_yaml_1.dump)(newPreferences))];
|
|
112
|
+
case 2:
|
|
113
|
+
_b.sent();
|
|
114
|
+
return [2 /*return*/];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}); };
|
|
118
|
+
exports.setPreference = setPreference;
|
|
119
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/preferences/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAA0B;AAC1B,yBAA6B;AAE7B,mCAAqC;AACrC,IAAM,SAAS,GAAG,UAAG,IAAA,YAAO,GAAE,gBAAa,CAAC;AAC5C,IAAM,IAAI,GAAG,UAAG,SAAS,qBAAkB,CAAC;AAE5C,IAAM,cAAc,GAAG;;;;;oBACf,qBAAM,qBAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAA;;qBAA3B,CAAC,CAAC,SAAyB,CAAC,EAA5B,wBAA4B;gBAC9B,qBAAM,qBAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAA;;gBAAzB,SAAyB,CAAC;;;gBAEpB,KAAA,cAAI,CAAA;gBAAC,qBAAM,qBAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAA;oBAA3D,sBAAO,CAAC,MAAA,kBAAK,SAA8C,EAAC,mCAAI,EAAE,CAGjE,EAAC;;;KACH,CAAC;AAEK,IAAM,aAAa,GAAG,UAAO,GAAW;;;;oBACzB,qBAAM,cAAc,EAAE,EAAA;;gBAApC,WAAW,GAAG,SAAsB;gBAC1C,sBAAO,GAAG,IAAI,WAAW,EAAC;;;KAC3B,CAAC;AAHW,QAAA,aAAa,iBAGxB;AACK,IAAM,aAAa,GAAG,UAAO,GAAW;;;;oBACzB,qBAAM,cAAc,EAAE,EAAA;;gBAApC,WAAW,GAAG,SAAsB;gBAC1C,sBAAO,WAAW,CAAC,GAAG,CAAC,EAAC;;;KACzB,CAAC;AAHW,QAAA,aAAa,iBAGxB;AAEK,IAAM,aAAa,GAAG,UAAO,GAAW,EAAE,KAAsB;;;;;oBACjD,qBAAM,cAAc,EAAE,EAAA;;gBAApC,WAAW,GAAG,SAAsB;gBAEpC,cAAc,yBACf,WAAW,gBACb,GAAG,IAAG,KAAK,MACb,CAAC;gBAEF,qBAAM,qBAAE,CAAC,SAAS,CAAC,IAAI,EAAE,IAAA,cAAI,EAAC,cAAc,CAAC,CAAC,EAAA;;gBAA9C,SAA8C,CAAC;;;;KAChD,CAAC;AATW,QAAA,aAAa,iBASxB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const getGitRoot: () => Promise<string>;
|
|
2
|
+
export declare const getRootGitlabCiFile: () => Promise<string>;
|
|
3
|
+
export declare const readRootGitlabCiFile: () => Promise<any[]>;
|
|
4
|
+
export declare const hasGitlabCiFile: () => Promise<boolean>;
|
|
5
|
+
export declare const getProjectNamespace: (envComponent: string) => Promise<string>;
|
|
6
|
+
export declare const getProjectPods: (envComponent: string) => Promise<import("@kubernetes/client-node").V1Pod[]>;
|
|
7
|
+
export declare const getProjectPvcs: (envComponent: string) => Promise<import("@kubernetes/client-node").V1PersistentVolumeClaim[]>;
|
|
8
|
+
export declare const getProjectPodNames: (envComponent: string) => Promise<string[]>;
|
|
@@ -0,0 +1,153 @@
|
|
|
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;
|
|
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
|
+
return [2 /*return*/, res.body.items];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}); };
|
|
123
|
+
exports.getProjectPods = getProjectPods;
|
|
124
|
+
var getProjectPvcs = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
|
|
125
|
+
var namespace, k8sApi, res;
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
switch (_a.label) {
|
|
128
|
+
case 0: return [4 /*yield*/, (0, exports.getProjectNamespace)(envComponent)];
|
|
129
|
+
case 1:
|
|
130
|
+
namespace = _a.sent();
|
|
131
|
+
k8sApi = (0, k8sApi_1.getk8sApi)();
|
|
132
|
+
return [4 /*yield*/, k8sApi.listNamespacedPersistentVolumeClaim(namespace)];
|
|
133
|
+
case 2:
|
|
134
|
+
res = _a.sent();
|
|
135
|
+
return [2 /*return*/, res.body.items];
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}); };
|
|
139
|
+
exports.getProjectPvcs = getProjectPvcs;
|
|
140
|
+
var getProjectPodNames = function (envComponent) { return __awaiter(void 0, void 0, void 0, function () {
|
|
141
|
+
var pods;
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
switch (_a.label) {
|
|
144
|
+
case 0: return [4 /*yield*/, (0, exports.getProjectPods)(envComponent)];
|
|
145
|
+
case 1:
|
|
146
|
+
pods = _a.sent();
|
|
147
|
+
return [2 /*return*/, pods.map(function (n) { return n.metadata.name; })];
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}); };
|
|
151
|
+
exports.getProjectPodNames = getProjectPodNames;
|
|
152
|
+
var templateObject_1;
|
|
153
|
+
//# 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;gBAErD,sBAAO,GAAG,CAAC,IAAI,CAAC,KAAK,EAAC;;;KACvB,CAAC;AANW,QAAA,cAAc,kBAMzB;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,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,54 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"lint": "eslint \"src/**/*.ts\"",
|
|
9
9
|
"lint:fix": "eslint \"src/**/*.ts\" --fix",
|
|
10
|
-
"test": "
|
|
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
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"catenv": "./bin/catenv",
|
|
16
|
+
"catladder": "./bin/catladder"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@
|
|
20
|
-
"@kubernetes/client-node": "^0.16.
|
|
19
|
+
"@catladder/pipeline": "0.0.0-waitfor-deploy-e64a33ba",
|
|
20
|
+
"@kubernetes/client-node": "^0.16.2",
|
|
21
21
|
"child-process-promise": "^2.2.1",
|
|
22
|
-
"clipboardy": "^2.2.0",
|
|
23
22
|
"command-exists-promise": "^2.0.2",
|
|
24
23
|
"common-tags": "^1.8.0",
|
|
25
24
|
"dayjs": "^1.10.4",
|
|
26
25
|
"fs-extra": "^7.0.1",
|
|
27
|
-
"git-repo-name": "^1.0.1",
|
|
28
26
|
"gitlab": "^4.4.1",
|
|
29
|
-
"js-yaml": "^
|
|
30
|
-
"lodash": "^4.17.
|
|
27
|
+
"js-yaml": "^4.1.0",
|
|
28
|
+
"lodash": "^4.17.21",
|
|
31
29
|
"memoizee": "^0.4.14",
|
|
32
30
|
"node-fetch": "^2.3.0",
|
|
33
31
|
"open": "^8.4.0",
|
|
34
|
-
"
|
|
35
|
-
"open-in-editor": "^2.2.0",
|
|
32
|
+
"prettier": "^2.5.1",
|
|
36
33
|
"tmp-promise": "^2.0.2",
|
|
37
34
|
"update-notifier": "^2.5.0",
|
|
38
35
|
"vorpal": "^1.12.0",
|
|
39
|
-
"
|
|
40
|
-
"yawn-yaml": "^1.3.4"
|
|
36
|
+
"zx": "^4.3.0"
|
|
41
37
|
},
|
|
42
38
|
"engines": {
|
|
43
39
|
"node": ">=12.0.0"
|
|
44
40
|
},
|
|
45
41
|
"devDependencies": {
|
|
46
|
-
"@semantic-release/git": "^10.0.1",
|
|
47
|
-
"@semantic-release/gitlab": "^7.0.4",
|
|
48
42
|
"@tsconfig/node14": "^1.0.1",
|
|
49
43
|
"@types/common-tags": "^1.8.0",
|
|
50
44
|
"@types/fs-extra": "^5.0.4",
|
|
51
|
-
"@types/js-yaml": "^
|
|
45
|
+
"@types/js-yaml": "^4.0.5",
|
|
52
46
|
"@types/lodash": "^4.14.119",
|
|
53
47
|
"@types/memoizee": "^0.4.2",
|
|
54
48
|
"@types/node-fetch": "^2.1.4",
|
|
55
49
|
"@types/request": "^2.48.1",
|
|
50
|
+
"@types/tmp": "^0.2.3",
|
|
56
51
|
"@types/update-notifier": "^2.5.0",
|
|
57
52
|
"@types/vorpal": "^1.12.0",
|
|
58
53
|
"@types/websocket": "^0.0.40",
|
|
59
54
|
"@types/yargs": "^13.0.0",
|
|
60
|
-
"
|
|
61
|
-
"@typescript-eslint/parser": "^5.8.0",
|
|
55
|
+
"eslint": "^8.7.0",
|
|
62
56
|
"typescript": "^4.5.4"
|
|
63
57
|
},
|
|
64
|
-
"version": "0.0.0-
|
|
58
|
+
"version": "0.0.0-waitfor-deploy-e64a33ba",
|
|
59
|
+
"stableVersion": "0.0.0"
|
|
65
60
|
}
|
|
@@ -1,37 +1,65 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 (
|
|
13
|
-
variables = await
|
|
14
|
-
} else
|
|
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
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Object.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
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);
|