@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.
- package/.nvmrc +1 -1
- package/README.md +6 -3
- package/bin/catenv +3 -0
- package/bin/catenv-dev +3 -0
- package/bin/catladder +1 -1
- package/bin/catladder-dev +3 -0
- package/dist/apps/catenv/catenv.d.ts +3 -0
- package/dist/apps/catenv/catenv.js +66 -0
- package/dist/apps/catenv/catenv.js.map +1 -0
- package/dist/apps/catenv/printVariables.d.ts +3 -0
- package/dist/apps/catenv/printVariables.js +115 -0
- package/dist/apps/catenv/printVariables.js.map +1 -0
- package/dist/apps/catenv/types.d.ts +5 -0
- package/dist/apps/catenv/types.js +3 -0
- package/dist/apps/catenv/types.js.map +1 -0
- package/dist/apps/catenv/utils.d.ts +12 -0
- package/dist/apps/catenv/utils.js +108 -0
- package/dist/apps/catenv/utils.js.map +1 -0
- package/dist/apps/catenv/writeDotEnvFiles.d.ts +3 -0
- package/dist/apps/catenv/writeDotEnvFiles.js +94 -0
- package/dist/apps/catenv/writeDotEnvFiles.js.map +1 -0
- package/dist/apps/catenv/writeEnvDTs.d.ts +3 -0
- package/dist/apps/catenv/writeEnvDTs.js +114 -0
- package/dist/apps/catenv/writeEnvDTs.js.map +1 -0
- package/dist/apps/cli/cli.d.ts +2 -0
- package/dist/apps/cli/cli.js +83 -0
- package/dist/apps/cli/cli.js.map +1 -0
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.d.ts +3 -0
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js +180 -0
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +1 -0
- package/dist/apps/cli/commands/cloudSQL/index.d.ts +3 -0
- package/dist/apps/cli/commands/cloudSQL/index.js +50 -0
- package/dist/apps/cli/commands/cloudSQL/index.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 +191 -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 +121 -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 +179 -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 +164 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +5 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js +334 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -0
- package/dist/apps/cli/commands/project/commandDeletePods.d.ts +3 -0
- package/dist/apps/cli/commands/project/commandDeletePods.js +121 -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 +96 -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 +112 -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 +84 -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 +56 -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 +100 -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 +74 -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 +168 -0
- package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -0
- package/dist/apps/cli/commands/project/commandSecretsClearBackups.d.ts +5 -0
- package/dist/apps/cli/commands/project/commandSecretsClearBackups.js +90 -0
- package/dist/apps/cli/commands/project/commandSecretsClearBackups.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 +107 -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 +116 -0
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupCloudRun.d.ts +3 -0
- package/dist/apps/cli/commands/project/setup/setupCloudRun.js +118 -0
- package/dist/apps/cli/commands/project/setup/setupCloudRun.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 +81 -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 +139 -0
- package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -0
- package/dist/apps/cli/commands/project/setup/setupTopic.d.ts +2 -0
- package/dist/apps/cli/commands/project/setup/setupTopic.js +69 -0
- package/dist/apps/cli/commands/project/setup/setupTopic.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/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 +349 -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 +91 -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/bundles/catenv/index.js +46512 -0
- package/dist/bundles/catenv/xdg-open +1066 -0
- package/dist/bundles/cli/clipboard_i686.exe +0 -0
- package/dist/bundles/cli/clipboard_x86_64.exe +0 -0
- package/dist/bundles/cli/exec-child.js +39 -0
- package/dist/bundles/cli/index.js +363134 -0
- package/dist/bundles/cli/xdg-open +1066 -0
- package/dist/bundles/cli/xsel +0 -0
- package/dist/catenv.d.ts +1 -0
- package/dist/catenv.js +13 -0
- package/dist/catenv.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +8 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/constants.d.ts +2 -0
- package/dist/config/constants.js +6 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/getProjectConfig.d.ts +24 -0
- package/dist/config/getProjectConfig.js +313 -0
- package/dist/config/getProjectConfig.js.map +1 -0
- package/dist/config/parseChoice.d.ts +4 -0
- package/dist/config/parseChoice.js +9 -0
- package/dist/config/parseChoice.js.map +1 -0
- package/dist/gcloud/artifactsRegistry.d.ts +5 -0
- package/dist/gcloud/artifactsRegistry.js +59 -0
- package/dist/gcloud/artifactsRegistry.js.map +1 -0
- package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.d.ts +2 -0
- package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.js +67 -0
- package/dist/gcloud/cloudRun/getCloudRunDomainSuffix.js.map +1 -0
- package/dist/gcloud/cloudRun/openCloudRunDashboards.d.ts +3 -0
- package/dist/gcloud/cloudRun/openCloudRunDashboards.js +62 -0
- package/dist/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -0
- package/dist/gcloud/cloudSql/startProxy.d.ts +10 -0
- package/dist/gcloud/cloudSql/startProxy.js +121 -0
- package/dist/gcloud/cloudSql/startProxy.js.map +1 -0
- package/dist/gcloud/enableServices.d.ts +3 -0
- package/dist/gcloud/enableServices.js +63 -0
- package/dist/gcloud/enableServices.js.map +1 -0
- package/dist/gcloud/openDashboard.d.ts +2 -0
- package/dist/gcloud/openDashboard.js +66 -0
- package/dist/gcloud/openDashboard.js.map +1 -0
- package/dist/gcloud/serviceAccounts.d.ts +12 -0
- package/dist/gcloud/serviceAccounts.js +144 -0
- package/dist/gcloud/serviceAccounts.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/kubernetes/index.d.ts +3 -0
- package/dist/kubernetes/index.js +88 -0
- package/dist/kubernetes/index.js.map +1 -0
- package/dist/kubernetes/openKubernetesDashboards.d.ts +4 -0
- package/dist/kubernetes/openKubernetesDashboards.js +94 -0
- package/dist/kubernetes/openKubernetesDashboards.js.map +1 -0
- package/dist/kubernetes/portForward.d.ts +1 -0
- package/dist/kubernetes/portForward.js +55 -0
- package/dist/kubernetes/portForward.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 +68 -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 +24 -0
- package/dist/utils/gitlab.js +397 -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 +7 -0
- package/dist/utils/passwordstore/index.js +315 -0
- package/dist/utils/passwordstore/index.js.map +1 -0
- package/dist/utils/portForwards.d.ts +12 -0
- package/dist/utils/portForwards.js +120 -0
- package/dist/utils/portForwards.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 +5 -0
- package/dist/utils/projects/index.js +103 -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 +32 -35
- package/scripts/bundle +4 -0
- package/src/apps/catenv/catenv.ts +14 -37
- package/src/apps/catenv/printVariables.ts +58 -0
- package/src/apps/catenv/types.ts +6 -0
- package/src/apps/catenv/utils.ts +49 -0
- package/src/apps/catenv/writeDotEnvFiles.ts +44 -0
- package/src/apps/catenv/writeEnvDTs.ts +71 -0
- package/src/apps/{shell/shell.ts → cli/cli.ts} +13 -3
- package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +154 -0
- package/src/apps/cli/commands/cloudSQL/index.ts +8 -0
- package/src/apps/{shell → cli}/commands/general/index.ts +16 -52
- package/src/apps/{shell → cli}/commands/general/portForward.ts +7 -6
- package/src/apps/{shell → cli}/commands/mongodb/index.ts +2 -2
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoDestroyMember.ts +20 -22
- package/src/apps/{shell → cli}/commands/mongodb/projectMongoGetShell.ts +13 -11
- package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +65 -0
- package/src/apps/{shell → cli}/commands/mongodb/utils/index.ts +28 -19
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +139 -0
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +234 -0
- package/src/apps/{shell → cli}/commands/project/commandDeletePods.ts +13 -15
- package/src/apps/{shell → cli}/commands/project/commandDeleteProject.ts +8 -9
- package/src/apps/cli/commands/project/commandEnvVars.ts +18 -0
- package/src/apps/{shell → cli}/commands/project/commandGetMyTotalWorktime.ts +4 -4
- package/src/apps/cli/commands/project/commandGetShell.ts +36 -0
- package/src/apps/{shell → cli}/commands/project/commandGitlabCi.ts +3 -2
- package/src/apps/{shell/commands/project/commandInitProject.ts → cli/commands/project/commandInitProject.old.ts} +15 -7
- package/src/apps/cli/commands/project/commandListPods.ts +18 -0
- package/src/apps/{shell → cli}/commands/project/commandMigrateHelm3.ts +18 -8
- package/src/apps/cli/commands/project/commandNamespace.ts +14 -0
- package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +32 -0
- package/src/apps/cli/commands/project/commandOpenDashboard.ts +28 -0
- package/src/apps/cli/commands/project/commandOpenEnv.ts +22 -0
- package/src/apps/{shell → cli}/commands/project/commandOpenGit.ts +2 -2
- package/src/apps/{shell → cli}/commands/project/commandOpenGrafana.ts +10 -10
- package/src/apps/{shell → cli}/commands/project/commandOpenGrafanaPod.ts +14 -17
- package/src/apps/cli/commands/project/commandOpenLogs.ts +21 -0
- package/src/apps/{shell → cli}/commands/project/commandPauseProject.ts +10 -8
- package/src/apps/cli/commands/project/commandPortForward.ts +86 -0
- package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +27 -0
- package/src/apps/cli/commands/project/commandSetup.ts +12 -0
- package/src/apps/{shell → cli}/commands/project/commandTriggerCronjob.ts +13 -12
- package/src/apps/{shell → cli}/commands/project/index.ts +10 -10
- package/src/apps/cli/commands/project/setup/index.ts +44 -0
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +84 -0
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +84 -0
- package/src/apps/cli/commands/project/setup/setupContext.ts +44 -0
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +140 -0
- package/src/apps/cli/commands/project/setup/setupTopic.ts +22 -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 +58 -0
- package/src/apps/cli/commands/project/utils/showProjectBanner.ts +11 -0
- package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +32 -0
- package/src/apps/cli/config/writeConfig.ts +71 -0
- package/src/apps/cli/verify/index.ts +30 -0
- package/src/apps/cli/verify/migration/fromv2.ts +262 -0
- package/src/apps/cli/verify/migration/migrateSecrets.ts +47 -0
- package/src/apps/cli/verify/migration/oldGitlabCi.ts +48 -0
- package/src/catenv.ts +10 -0
- package/src/cli.ts +3 -0
- package/src/config/constants.ts +0 -3
- package/src/config/getProjectConfig.ts +200 -0
- package/src/config/parseChoice.ts +4 -0
- package/src/gcloud/artifactsRegistry.ts +16 -0
- package/src/gcloud/cloudRun/getCloudRunDomainSuffix.ts +35 -0
- package/src/gcloud/cloudRun/openCloudRunDashboards.ts +22 -0
- package/src/gcloud/cloudSql/startProxy.ts +74 -0
- package/src/gcloud/enableServices.ts +14 -0
- package/src/gcloud/openDashboard.ts +19 -0
- package/src/gcloud/serviceAccounts.ts +101 -0
- package/src/k8sApi/index.ts +22 -6
- package/src/kubernetes/index.ts +27 -0
- package/src/kubernetes/openKubernetesDashboards.ts +52 -0
- package/src/kubernetes/portForward.ts +15 -0
- package/src/types/child-process-promise.d.ts +37 -1
- package/src/types/types.ts +0 -2
- package/src/utils/cluster.ts +5 -14
- package/src/utils/editAsFile.ts +31 -0
- package/src/utils/files.ts +6 -2
- package/src/utils/gitlab.ts +263 -42
- package/src/utils/passwordstore/index.ts +6 -36
- package/src/utils/{portForward.ts → portForwards.ts} +27 -22
- package/src/utils/preferences/index.ts +6 -3
- package/src/utils/projects/index.ts +9 -149
- package/tsconfig.json +3 -7
- package/bin/catenv.sh +0 -1
- package/src/apps/shell/commands/mongodb/projectMongoPortForward.ts +0 -42
- 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/commandCopyDB.ts +0 -93
- package/src/apps/shell/commands/project/commandEnvVars.ts +0 -17
- package/src/apps/shell/commands/project/commandGetShell.ts +0 -35
- 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/commandOpenCostDashboard.ts +0 -29
- 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/commandPortForward.ts +0 -45
- 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/apps/shell/commands/theStuffThatReallyMatters/index.ts +0 -51
- 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
- /package/src/apps/{shell → cli}/commands/general/namespaceAutoCompletion.ts +0 -0
- /package/src/apps/{shell → cli}/utils/getGoogleAuthUserNumber.ts +0 -0
|
@@ -0,0 +1,315 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
exports.__esModule = true;
|
|
42
|
+
exports.trashItem = exports.insertPass = exports.syncBitwarden = exports.readPass = exports.hasBitwarden = exports.getOrganization = exports.getCollection = void 0;
|
|
43
|
+
var child_process_promise_1 = require("child-process-promise");
|
|
44
|
+
var command_exists_promise_1 = __importDefault(require("command-exists-promise"));
|
|
45
|
+
var dayjs_1 = __importDefault(require("dayjs"));
|
|
46
|
+
var preferences_1 = require("../preferences");
|
|
47
|
+
var DEBUG = false;
|
|
48
|
+
var unlockBitwarden = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
+
var promise, session;
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0:
|
|
53
|
+
console.error("");
|
|
54
|
+
console.error("# Bitwarden is locked, please unlock:");
|
|
55
|
+
console.error("");
|
|
56
|
+
promise = (0, child_process_promise_1.spawn)("bw", ["unlock", "--raw"], {
|
|
57
|
+
stdio: ["inherit", "pipe", "inherit"]
|
|
58
|
+
});
|
|
59
|
+
session = null;
|
|
60
|
+
promise.childProcess.stdout.on("data", function (d) { return (session = d.toString("utf-8")); });
|
|
61
|
+
return [4 /*yield*/, promise];
|
|
62
|
+
case 1:
|
|
63
|
+
_a.sent();
|
|
64
|
+
return [4 /*yield*/, (0, preferences_1.setPreference)("bwsession", session)];
|
|
65
|
+
case 2:
|
|
66
|
+
_a.sent();
|
|
67
|
+
return [2 /*return*/];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}); };
|
|
71
|
+
var loginBitwarden = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
72
|
+
var promise, session;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
75
|
+
case 0:
|
|
76
|
+
console.error("");
|
|
77
|
+
console.error("# Please login to Bitwarden:");
|
|
78
|
+
console.error("");
|
|
79
|
+
promise = (0, child_process_promise_1.spawn)("bw", ["login", "--raw"], {
|
|
80
|
+
stdio: ["inherit", "pipe", "inherit"]
|
|
81
|
+
});
|
|
82
|
+
session = null;
|
|
83
|
+
promise.childProcess.stdout.on("data", function (d) { return (session = d.toString("utf-8")); });
|
|
84
|
+
return [4 /*yield*/, promise];
|
|
85
|
+
case 1:
|
|
86
|
+
_a.sent();
|
|
87
|
+
return [4 /*yield*/, (0, preferences_1.setPreference)("bwsession", session)];
|
|
88
|
+
case 2:
|
|
89
|
+
_a.sent();
|
|
90
|
+
return [4 /*yield*/, (0, exports.syncBitwarden)(true)];
|
|
91
|
+
case 3:
|
|
92
|
+
_a.sent(); // needs syncing to work properly afterwards
|
|
93
|
+
return [2 /*return*/];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}); };
|
|
97
|
+
var execBitwardenCommand = function (command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
98
|
+
var session, fullCommand, stdout, e_1, isLocked, notLoggedIn;
|
|
99
|
+
return __generator(this, function (_a) {
|
|
100
|
+
switch (_a.label) {
|
|
101
|
+
case 0: return [4 /*yield*/, (0, preferences_1.hasPreference)("bwsession")];
|
|
102
|
+
case 1:
|
|
103
|
+
if (!!(_a.sent())) return [3 /*break*/, 3];
|
|
104
|
+
return [4 /*yield*/, loginBitwarden()];
|
|
105
|
+
case 2:
|
|
106
|
+
_a.sent();
|
|
107
|
+
_a.label = 3;
|
|
108
|
+
case 3: return [4 /*yield*/, (0, preferences_1.getPreference)("bwsession")];
|
|
109
|
+
case 4:
|
|
110
|
+
session = _a.sent();
|
|
111
|
+
fullCommand = "BW_SESSION='".concat(session, "' bw ").concat(command, " --raw --nointeraction");
|
|
112
|
+
if (DEBUG) {
|
|
113
|
+
console.log(fullCommand);
|
|
114
|
+
console.time(fullCommand);
|
|
115
|
+
}
|
|
116
|
+
_a.label = 5;
|
|
117
|
+
case 5:
|
|
118
|
+
_a.trys.push([5, 7, , 13]);
|
|
119
|
+
return [4 /*yield*/, (0, child_process_promise_1.exec)(fullCommand)];
|
|
120
|
+
case 6:
|
|
121
|
+
stdout = (_a.sent()).stdout;
|
|
122
|
+
if (DEBUG) {
|
|
123
|
+
console.timeEnd(fullCommand);
|
|
124
|
+
}
|
|
125
|
+
if (!stdout) {
|
|
126
|
+
return [2 /*return*/, null];
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
return [2 /*return*/, JSON.parse(stdout)];
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
// no json
|
|
133
|
+
return [2 /*return*/, stdout];
|
|
134
|
+
}
|
|
135
|
+
return [3 /*break*/, 13];
|
|
136
|
+
case 7:
|
|
137
|
+
e_1 = _a.sent();
|
|
138
|
+
isLocked = e_1.toString().includes("Vault is locked");
|
|
139
|
+
notLoggedIn = e_1.toString().includes("You are not logged in");
|
|
140
|
+
if (!isLocked) return [3 /*break*/, 9];
|
|
141
|
+
return [4 /*yield*/, unlockBitwarden()];
|
|
142
|
+
case 8:
|
|
143
|
+
_a.sent();
|
|
144
|
+
return [2 /*return*/, execBitwardenCommand(command)];
|
|
145
|
+
case 9:
|
|
146
|
+
if (!notLoggedIn) return [3 /*break*/, 11];
|
|
147
|
+
return [4 /*yield*/, loginBitwarden()];
|
|
148
|
+
case 10:
|
|
149
|
+
_a.sent();
|
|
150
|
+
return [2 /*return*/, execBitwardenCommand(command)];
|
|
151
|
+
case 11: throw e_1;
|
|
152
|
+
case 12: return [3 /*break*/, 13];
|
|
153
|
+
case 13: return [2 /*return*/];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}); };
|
|
157
|
+
var getCollection = function (collectionName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
158
|
+
return __generator(this, function (_a) {
|
|
159
|
+
return [2 /*return*/, execBitwardenCommand("get collection ".concat(collectionName))];
|
|
160
|
+
});
|
|
161
|
+
}); };
|
|
162
|
+
exports.getCollection = getCollection;
|
|
163
|
+
var getOrganization = function (organizationName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
164
|
+
return __generator(this, function (_a) {
|
|
165
|
+
return [2 /*return*/, execBitwardenCommand("get organization ".concat(organizationName))];
|
|
166
|
+
});
|
|
167
|
+
}); };
|
|
168
|
+
exports.getOrganization = getOrganization;
|
|
169
|
+
var catladderCollectionId;
|
|
170
|
+
var getCatladderCollectionId = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
171
|
+
return __generator(this, function (_a) {
|
|
172
|
+
switch (_a.label) {
|
|
173
|
+
case 0:
|
|
174
|
+
if (!!catladderCollectionId) return [3 /*break*/, 2];
|
|
175
|
+
return [4 /*yield*/, (0, exports.getCollection)("catladder")];
|
|
176
|
+
case 1:
|
|
177
|
+
catladderCollectionId = (_a.sent()).id;
|
|
178
|
+
_a.label = 2;
|
|
179
|
+
case 2: return [2 /*return*/, catladderCollectionId];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}); };
|
|
183
|
+
var panterOrganizationId;
|
|
184
|
+
var getPanterOrganizationId = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
185
|
+
return __generator(this, function (_a) {
|
|
186
|
+
switch (_a.label) {
|
|
187
|
+
case 0:
|
|
188
|
+
if (!!panterOrganizationId) return [3 /*break*/, 2];
|
|
189
|
+
return [4 /*yield*/, (0, exports.getOrganization)("Panter AG")];
|
|
190
|
+
case 1:
|
|
191
|
+
panterOrganizationId = (_a.sent()).id;
|
|
192
|
+
_a.label = 2;
|
|
193
|
+
case 2: return [2 /*return*/, panterOrganizationId];
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}); };
|
|
197
|
+
var encode = function (data) {
|
|
198
|
+
return Buffer.from(JSON.stringify(data)).toString("base64");
|
|
199
|
+
};
|
|
200
|
+
var hasBitwarden = function () { return (0, command_exists_promise_1["default"])("bw"); };
|
|
201
|
+
exports.hasBitwarden = hasBitwarden;
|
|
202
|
+
var getItem = function (path) { return __awaiter(void 0, void 0, void 0, function () {
|
|
203
|
+
return __generator(this, function (_a) {
|
|
204
|
+
return [2 /*return*/, execBitwardenCommand("get item ".concat(path))];
|
|
205
|
+
});
|
|
206
|
+
}); };
|
|
207
|
+
var readPass = function (path) { return __awaiter(void 0, void 0, void 0, function () {
|
|
208
|
+
var result;
|
|
209
|
+
var _a;
|
|
210
|
+
return __generator(this, function (_b) {
|
|
211
|
+
switch (_b.label) {
|
|
212
|
+
case 0: return [4 /*yield*/, getItem(path)];
|
|
213
|
+
case 1:
|
|
214
|
+
result = _b.sent();
|
|
215
|
+
return [2 /*return*/, result.notes || ((_a = result.login) === null || _a === void 0 ? void 0 : _a.password)];
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}); };
|
|
219
|
+
exports.readPass = readPass;
|
|
220
|
+
var MAX_SYNC_AGE_IN_MINUTES = 30;
|
|
221
|
+
var syncBitwarden = function (force) {
|
|
222
|
+
if (force === void 0) { force = true; }
|
|
223
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
224
|
+
var lastSync, _a;
|
|
225
|
+
return __generator(this, function (_b) {
|
|
226
|
+
switch (_b.label) {
|
|
227
|
+
case 0: return [4 /*yield*/, (0, preferences_1.hasPreference)("bwLastSync")];
|
|
228
|
+
case 1:
|
|
229
|
+
if (!(_b.sent())) return [3 /*break*/, 3];
|
|
230
|
+
return [4 /*yield*/, (0, preferences_1.getPreference)("bwLastSync")];
|
|
231
|
+
case 2:
|
|
232
|
+
_a = _b.sent();
|
|
233
|
+
return [3 /*break*/, 4];
|
|
234
|
+
case 3:
|
|
235
|
+
_a = null;
|
|
236
|
+
_b.label = 4;
|
|
237
|
+
case 4:
|
|
238
|
+
lastSync = _a;
|
|
239
|
+
if (!(force ||
|
|
240
|
+
!lastSync ||
|
|
241
|
+
(0, dayjs_1["default"])().diff(lastSync, "minutes") >= MAX_SYNC_AGE_IN_MINUTES)) return [3 /*break*/, 7];
|
|
242
|
+
return [4 /*yield*/, execBitwardenCommand("sync")];
|
|
243
|
+
case 5:
|
|
244
|
+
_b.sent();
|
|
245
|
+
return [4 /*yield*/, (0, preferences_1.setPreference)("bwLastSync", new Date().toISOString())];
|
|
246
|
+
case 6:
|
|
247
|
+
_b.sent();
|
|
248
|
+
return [3 /*break*/, 7];
|
|
249
|
+
case 7: return [2 /*return*/];
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
exports.syncBitwarden = syncBitwarden;
|
|
255
|
+
var insertPass = function (path, content) { return __awaiter(void 0, void 0, void 0, function () {
|
|
256
|
+
var value, result;
|
|
257
|
+
var _a;
|
|
258
|
+
return __generator(this, function (_b) {
|
|
259
|
+
switch (_b.label) {
|
|
260
|
+
case 0:
|
|
261
|
+
_a = {
|
|
262
|
+
type: 2,
|
|
263
|
+
secureNote: { type: 0 },
|
|
264
|
+
name: path,
|
|
265
|
+
notes: content
|
|
266
|
+
};
|
|
267
|
+
return [4 /*yield*/, getCatladderCollectionId()];
|
|
268
|
+
case 1:
|
|
269
|
+
value = (_a.collectionIds = [_b.sent()],
|
|
270
|
+
_a);
|
|
271
|
+
return [4 /*yield*/, execBitwardenCommand("create item ".concat(encode(value)))];
|
|
272
|
+
case 2:
|
|
273
|
+
result = _b.sent();
|
|
274
|
+
return [4 /*yield*/, share(result.id)];
|
|
275
|
+
case 3:
|
|
276
|
+
_b.sent();
|
|
277
|
+
return [2 /*return*/];
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}); };
|
|
281
|
+
exports.insertPass = insertPass;
|
|
282
|
+
var share = function (itemId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
283
|
+
var _a, _b, _c, _d, _e, _f;
|
|
284
|
+
return __generator(this, function (_g) {
|
|
285
|
+
switch (_g.label) {
|
|
286
|
+
case 0:
|
|
287
|
+
_a = execBitwardenCommand;
|
|
288
|
+
_d = (_c = "share ".concat(itemId, " ")).concat;
|
|
289
|
+
return [4 /*yield*/, getPanterOrganizationId()];
|
|
290
|
+
case 1:
|
|
291
|
+
_e = (_b = _d.apply(_c, [_g.sent(), " "])).concat;
|
|
292
|
+
_f = encode;
|
|
293
|
+
return [4 /*yield*/, getCatladderCollectionId()];
|
|
294
|
+
case 2: return [2 /*return*/, _a.apply(void 0, [_e.apply(_b, [_f.apply(void 0, [[
|
|
295
|
+
_g.sent()
|
|
296
|
+
]])])])];
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}); };
|
|
300
|
+
var trashItem = function (path) { return __awaiter(void 0, void 0, void 0, function () {
|
|
301
|
+
var item, result;
|
|
302
|
+
return __generator(this, function (_a) {
|
|
303
|
+
switch (_a.label) {
|
|
304
|
+
case 0: return [4 /*yield*/, getItem(path)];
|
|
305
|
+
case 1:
|
|
306
|
+
item = _a.sent();
|
|
307
|
+
return [4 /*yield*/, execBitwardenCommand("delete item ".concat(item.id))];
|
|
308
|
+
case 2:
|
|
309
|
+
result = _a.sent();
|
|
310
|
+
return [2 /*return*/, result];
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
}); };
|
|
314
|
+
exports.trashItem = trashItem;
|
|
315
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/passwordstore/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAAoD;AACpD,kFAAmD;AACnD,gDAA0B;AAC1B,8CAA6E;AAE7E,IAAM,KAAK,GAAG,KAAK,CAAC;AAEpB,IAAM,eAAe,GAAG;;;;;gBACtB,OAAO,CAAC,KAA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xB;AACK,IAAM,UAAU,GAAG,UAAO,IAAY,EAAE,OAAe;;;;;;;oBAE1D,IAAI,EAAE,CAAC;oBACP,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;oBACvB,IAAI,EAAE,IAAI;oBAEV,KAAK,EAAE,OAAO;;gBACE,qBAAM,wBAAwB,EAAE,EAAA;;gBAN5C,KAAK,IAMT,gBAAa,IAAG,SAAgC,CAAC;uBAClD;gBACc,qBAAM,oBAAoB,CAAC,sBAAe,MAAM,CAAC,KAAK,CAAC,CAAE,CAAC,EAAA;;gBAAnE,MAAM,GAAG,SAA0D;gBACzE,qBAAM,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,EAAA;;gBAAtB,SAAsB,CAAC;;;;KACxB,CAAC;AAXW,QAAA,UAAU,cAWrB;AAEF,IAAM,KAAK,GAAG,UAAO,MAAc;;;;;gBACjC,KAAA,oBAAoB,CAAA;2CACT,MAAM;gBAAI,qBAAM,uBAAuB,EAAE,EAAA;;yCAA/B,SAA+B;gBAAI,KAAA,MAAM,CAAA;gBAC1D,qBAAM,wBAAwB,EAAE,EAAA;oBAFpC,sBAAA,kBACE,cAAsD;gCACpD,SAAgC;+BAChC,EAAE,EACL,EAAA;;;KAAA,CAAC;AAEG,IAAM,SAAS,GAAG,UAAO,IAAY;;;;oBAC7B,qBAAM,OAAO,CAAC,IAAI,CAAC,EAAA;;gBAA1B,IAAI,GAAG,SAAmB;gBAEjB,qBAAM,oBAAoB,CAAC,sBAAe,IAAI,CAAC,EAAE,CAAE,CAAC,EAAA;;gBAA7D,MAAM,GAAG,SAAoD;gBAEnE,sBAAO,MAAM,EAAC;;;KACf,CAAC;AANW,QAAA,SAAS,aAMpB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { ReadStream } from "fs-extra";
|
|
3
|
+
export declare type PortForward = Promise<unknown> & {
|
|
4
|
+
childProcess: {
|
|
5
|
+
stdout: ReadStream;
|
|
6
|
+
kill: () => any;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const stopPortForward: (name: string) => Promise<void>;
|
|
10
|
+
export declare const getAllRunningPortForwards: () => string[];
|
|
11
|
+
export declare const startPortForwardCommand: (name: string, command: string) => Promise<void>;
|
|
12
|
+
export declare const stopAllPortForwards: () => Promise<void>;
|
|
@@ -0,0 +1,120 @@
|
|
|
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.stopAllPortForwards = exports.startPortForwardCommand = exports.getAllRunningPortForwards = exports.stopPortForward = void 0;
|
|
51
|
+
var child_process_promise_1 = require("child-process-promise");
|
|
52
|
+
var portForwards = new Map();
|
|
53
|
+
var stopPortForward = function (name) { return __awaiter(void 0, void 0, void 0, function () {
|
|
54
|
+
var old, e_1;
|
|
55
|
+
return __generator(this, function (_a) {
|
|
56
|
+
switch (_a.label) {
|
|
57
|
+
case 0:
|
|
58
|
+
old = portForwards.get(name);
|
|
59
|
+
if (!old) return [3 /*break*/, 5];
|
|
60
|
+
_a.label = 1;
|
|
61
|
+
case 1:
|
|
62
|
+
_a.trys.push([1, 3, , 4]);
|
|
63
|
+
old.childProcess.kill();
|
|
64
|
+
return [4 /*yield*/, old];
|
|
65
|
+
case 2:
|
|
66
|
+
_a.sent();
|
|
67
|
+
return [3 /*break*/, 4];
|
|
68
|
+
case 3:
|
|
69
|
+
e_1 = _a.sent();
|
|
70
|
+
return [3 /*break*/, 4];
|
|
71
|
+
case 4:
|
|
72
|
+
portForwards["delete"](name);
|
|
73
|
+
_a.label = 5;
|
|
74
|
+
case 5: return [2 /*return*/];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}); };
|
|
78
|
+
exports.stopPortForward = stopPortForward;
|
|
79
|
+
var getAllRunningPortForwards = function () {
|
|
80
|
+
return Array.from(portForwards.keys());
|
|
81
|
+
};
|
|
82
|
+
exports.getAllRunningPortForwards = getAllRunningPortForwards;
|
|
83
|
+
var addPortForward = function (name, portForward) {
|
|
84
|
+
portForwards.set(name, portForward);
|
|
85
|
+
};
|
|
86
|
+
var startPortForwardCommand = function (name, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
87
|
+
var _a, cmd, args, promise;
|
|
88
|
+
return __generator(this, function (_b) {
|
|
89
|
+
switch (_b.label) {
|
|
90
|
+
case 0:
|
|
91
|
+
// stop if already there
|
|
92
|
+
return [4 /*yield*/, (0, exports.stopPortForward)(name)];
|
|
93
|
+
case 1:
|
|
94
|
+
// stop if already there
|
|
95
|
+
_b.sent();
|
|
96
|
+
_a = command.split(" "), cmd = _a[0], args = _a.slice(1);
|
|
97
|
+
promise = (0, child_process_promise_1.spawn)(cmd, args, {
|
|
98
|
+
env: __assign(__assign({}, process.env), { DEBUG: "" })
|
|
99
|
+
});
|
|
100
|
+
addPortForward(name, promise);
|
|
101
|
+
// wait a moment so that is surley started, unfortunatly we don't know that
|
|
102
|
+
return [4 /*yield*/, new Promise(function (r) { return setTimeout(r, 1000); })];
|
|
103
|
+
case 2:
|
|
104
|
+
// wait a moment so that is surley started, unfortunatly we don't know that
|
|
105
|
+
_b.sent();
|
|
106
|
+
return [2 /*return*/];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}); };
|
|
110
|
+
exports.startPortForwardCommand = startPortForwardCommand;
|
|
111
|
+
var stopAllPortForwards = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
112
|
+
return __generator(this, function (_a) {
|
|
113
|
+
(0, exports.getAllRunningPortForwards)().forEach(function (name) {
|
|
114
|
+
(0, exports.stopPortForward)(name);
|
|
115
|
+
});
|
|
116
|
+
return [2 /*return*/];
|
|
117
|
+
});
|
|
118
|
+
}); };
|
|
119
|
+
exports.stopAllPortForwards = stopAllPortForwards;
|
|
120
|
+
//# sourceMappingURL=portForwards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portForwards.js","sourceRoot":"","sources":["../../src/utils/portForwards.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA8C;AAU9C,IAAM,YAAY,GAAG,IAAI,GAAG,EAAuB,CAAC;AAE7C,IAAM,eAAe,GAAG,UAAO,IAAY;;;;;gBAC1C,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;qBAE/B,GAAG,EAAH,wBAAG;;;;gBAEH,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;gBACxB,qBAAM,GAAG,EAAA;;gBAAT,SAAS,CAAC;;;;;;gBAIZ,YAAY,CAAC,QAAM,CAAA,CAAC,IAAI,CAAC,CAAC;;;;;KAE7B,CAAC;AAZW,QAAA,eAAe,mBAY1B;AAEK,IAAM,yBAAyB,GAAG;IACvC,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;AACzC,CAAC,CAAC;AAFW,QAAA,yBAAyB,6BAEpC;AAEF,IAAM,cAAc,GAAG,UAAC,IAAY,EAAE,WAAwB;IAC5D,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AACtC,CAAC,CAAC;AAEK,IAAM,uBAAuB,GAAG,UACrC,IAAY,EACZ,OAAe;;;;;YAEf,wBAAwB;YACxB,qBAAM,IAAA,uBAAe,EAAC,IAAI,CAAC,EAAA;;gBAD3B,wBAAwB;gBACxB,SAA2B,CAAC;gBACtB,KAAiB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAlC,GAAG,QAAA,EAAK,IAAI,cAAA,CAAuB;gBAEpC,OAAO,GAAG,IAAA,6BAAK,EAAC,GAAG,EAAE,IAAI,EAAE;oBAC/B,GAAG,wBACE,OAAO,CAAC,GAAG,KACd,KAAK,EAAE,EAAE,GACV;iBACF,CAAgB,CAAC;gBAClB,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAC9B,2EAA2E;gBAC3E,qBAAM,IAAI,OAAO,CAAC,UAAC,CAAC,IAAK,OAAA,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,EAAnB,CAAmB,CAAC,EAAA;;gBAD7C,2EAA2E;gBAC3E,SAA6C,CAAC;;;;KAC/C,CAAC;AAjBW,QAAA,uBAAuB,2BAiBlC;AACK,IAAM,mBAAmB,GAAG;;QACjC,IAAA,iCAAyB,GAAE,CAAC,OAAO,CAAC,UAAC,IAAI;YACvC,IAAA,uBAAe,EAAC,IAAI,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;;;KACJ,CAAC;AAJW,QAAA,mBAAmB,uBAI9B"}
|
|
@@ -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,5 @@
|
|
|
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>;
|