@catladder/cli 0.0.0-test7 → 0.0.0-update-meteor-a29e7983
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
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
16
|
package/README.md
CHANGED
|
@@ -4,18 +4,21 @@ panter cli tool for kubernetes
|
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
`yarn global add @
|
|
7
|
+
`yarn global add @catladder/cli`
|
|
8
8
|
|
|
9
9
|
or npm users
|
|
10
10
|
|
|
11
|
-
`npm install -g @
|
|
11
|
+
`npm install -g @catladder/cli`
|
|
12
|
+
|
|
13
|
+
_Note: if you have `@panter/catladder` installed upgrade it to >=4.0.0 before installing `@catladder/cli`_
|
|
12
14
|
|
|
13
15
|
## Getting started
|
|
16
|
+
|
|
14
17
|
You'll need
|
|
18
|
+
|
|
15
19
|
- Google Cloud SDK ([see installation instructions](https://cloud.google.com/sdk/docs/install))
|
|
16
20
|
- Kubectl ([see installation instructions](https://kubernetes.io/docs/tasks/tools/))
|
|
17
21
|
- Cloud SQL Auth proxy ([see installation instructions](https://cloud.google.com/sql/docs/postgres/sql-proxy#install))
|
|
18
|
-
- Bitwarden CLI ([see installation instructions](https://bitwarden.com/help/article/cli/))
|
|
19
22
|
|
|
20
23
|
Afterwards you need to connect to your cluster, e.g. `gcloud container clusters get-credentials clustername --zone google-zone --project google-project-id`
|
|
21
24
|
In most cases you'll find the details on the Google Cloud [cluster overview ](https://console.cloud.google.com/kubernetes/list?project=skynet-164509)
|
package/bin/catenv
ADDED
package/bin/catenv-dev
ADDED
package/bin/catladder
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
var getProjectConfig_1 = require("../../config/getProjectConfig");
|
|
40
|
+
var printVariables_1 = require("./printVariables");
|
|
41
|
+
var writeDotEnvFiles_1 = require("./writeDotEnvFiles");
|
|
42
|
+
var writeEnvDTs_1 = require("./writeEnvDTs");
|
|
43
|
+
exports["default"] = (function (choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
44
|
+
var config;
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
switch (_a.label) {
|
|
47
|
+
case 0: return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
|
|
48
|
+
case 1:
|
|
49
|
+
config = _a.sent();
|
|
50
|
+
if (!config) {
|
|
51
|
+
return [2 /*return*/];
|
|
52
|
+
}
|
|
53
|
+
return [4 /*yield*/, (0, printVariables_1.printVariables)(config, choice)];
|
|
54
|
+
case 2:
|
|
55
|
+
_a.sent();
|
|
56
|
+
return [4 /*yield*/, (0, writeDotEnvFiles_1.writeDotEnvFiles)(config, choice)];
|
|
57
|
+
case 3:
|
|
58
|
+
_a.sent();
|
|
59
|
+
return [4 /*yield*/, (0, writeEnvDTs_1.writeDTsFiles)(config, choice)];
|
|
60
|
+
case 4:
|
|
61
|
+
_a.sent();
|
|
62
|
+
return [2 /*return*/];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}); });
|
|
66
|
+
//# sourceMappingURL=catenv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catenv.js","sourceRoot":"","sources":["../../../src/apps/catenv/catenv.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAiE;AACjE,mDAAkD;AAElD,uDAAsD;AACtD,6CAA8C;AAE9C,sBAAe,UAAO,MAAe;;;;oBACpB,qBAAM,IAAA,mCAAgB,GAAE,EAAA;;gBAAjC,MAAM,GAAG,SAAwB;gBACvC,IAAI,CAAC,MAAM,EAAE;oBACX,sBAAO;iBACR;gBAED,qBAAM,IAAA,+BAAc,EAAC,MAAM,EAAE,MAAM,CAAC,EAAA;;gBAApC,SAAoC,CAAC;gBAErC,qBAAM,IAAA,mCAAgB,EAAC,MAAM,EAAE,MAAM,CAAC,EAAA;;gBAAtC,SAAsC,CAAC;gBAEvC,qBAAM,IAAA,2BAAa,EAAC,MAAM,EAAE,MAAM,CAAC,EAAA;;gBAAnC,SAAmC,CAAC;;;;KACrC,EAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
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.printVariables = void 0;
|
|
51
|
+
var getProjectConfig_1 = require("../../config/getProjectConfig");
|
|
52
|
+
var utils_1 = require("./utils");
|
|
53
|
+
var getAllVariablesToPrint = function (config, choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
54
|
+
var _a, env, currentComponent;
|
|
55
|
+
return __generator(this, function (_b) {
|
|
56
|
+
switch (_b.label) {
|
|
57
|
+
case 0: return [4 /*yield*/, (0, utils_1.getCurrentComponentAndEnvFromChoice)(config, choice)];
|
|
58
|
+
case 1:
|
|
59
|
+
_a = _b.sent(), env = _a.env, currentComponent = _a.currentComponent;
|
|
60
|
+
if (!currentComponent) return [3 /*break*/, 3];
|
|
61
|
+
// don't print vars if dotenv is enabled
|
|
62
|
+
if (config.components[currentComponent].dotEnv) {
|
|
63
|
+
return [2 /*return*/, {}];
|
|
64
|
+
}
|
|
65
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(null, env, currentComponent)];
|
|
66
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
67
|
+
case 3: return [4 /*yield*/, Object.keys(config.components).reduce(function (acc, componentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
68
|
+
var subappvars, _a;
|
|
69
|
+
return __generator(this, function (_b) {
|
|
70
|
+
switch (_b.label) {
|
|
71
|
+
case 0:
|
|
72
|
+
if (!config.components[componentName].dotEnv) return [3 /*break*/, 2];
|
|
73
|
+
return [4 /*yield*/, acc];
|
|
74
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
75
|
+
case 2: return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(null, env, componentName)];
|
|
76
|
+
case 3:
|
|
77
|
+
subappvars = _b.sent();
|
|
78
|
+
delete subappvars["_ALL_ENV_VAR_KEYS"];
|
|
79
|
+
_a = [{}];
|
|
80
|
+
return [4 /*yield*/, acc];
|
|
81
|
+
case 4: return [2 /*return*/, __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_b.sent())])), subappvars]), Object.fromEntries(Object.entries(subappvars).map(function (_a) {
|
|
82
|
+
var key = _a[0], value = _a[1];
|
|
83
|
+
return [
|
|
84
|
+
"".concat((0, utils_1.sanitizeEnvVarName)(componentName.toUpperCase()), "_").concat(key),
|
|
85
|
+
value,
|
|
86
|
+
];
|
|
87
|
+
}))])];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}); }, Promise.resolve({}))];
|
|
91
|
+
case 4:
|
|
92
|
+
// when in a monorep and not in a subapp, merge all env vars.
|
|
93
|
+
// this is not 100% correct, but better than not exporting any vars at all
|
|
94
|
+
// so we also add prefixed variants
|
|
95
|
+
return [2 /*return*/, _b.sent()];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}); };
|
|
99
|
+
var printVariables = function (config, choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
100
|
+
var variables;
|
|
101
|
+
return __generator(this, function (_a) {
|
|
102
|
+
switch (_a.label) {
|
|
103
|
+
case 0: return [4 /*yield*/, getAllVariablesToPrint(config, choice)];
|
|
104
|
+
case 1:
|
|
105
|
+
variables = _a.sent();
|
|
106
|
+
console.log(makeExportKeyValuestring(variables));
|
|
107
|
+
return [2 /*return*/];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}); };
|
|
111
|
+
exports.printVariables = printVariables;
|
|
112
|
+
var makeExportKeyValuestring = function (variables) {
|
|
113
|
+
return (0, utils_1.makeKeyValueString)(variables, "export ");
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=printVariables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printVariables.js","sourceRoot":"","sources":["../../../src/apps/catenv/printVariables.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kEAAmE;AAEnE,iCAIiB;AAEjB,IAAM,sBAAsB,GAAG,UAAO,MAAc,EAAE,MAAe;;;;oBACjC,qBAAM,IAAA,2CAAmC,EACzE,MAAM,EACN,MAAM,CACP,EAAA;;gBAHK,KAA4B,SAGjC,EAHO,GAAG,SAAA,EAAE,gBAAgB,sBAAA;qBAKzB,gBAAgB,EAAhB,wBAAgB;gBAClB,wCAAwC;gBACxC,IAAI,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,MAAM,EAAE;oBAC9C,sBAAO,EAAE,EAAC;iBACX;gBACM,qBAAM,IAAA,qCAAkB,EAAC,IAAI,EAAE,GAAG,EAAE,gBAAgB,CAAC,EAAA;oBAA5D,sBAAO,SAAqD,EAAC;oBAKtD,qBAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAChD,UAAO,GAAG,EAAE,aAAa;;;;;qCAEnB,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,MAAM,EAAvC,wBAAuC;gCAClC,qBAAM,GAAG,EAAA;oCAAhB,sBAAO,SAAS,EAAC;oCAEA,qBAAM,IAAA,qCAAkB,EAAC,IAAI,EAAE,GAAG,EAAE,aAAa,CAAC,EAAA;;gCAA/D,UAAU,GAAG,SAAkD;gCACrE,OAAO,UAAU,CAAC,mBAAmB,CAAC,CAAC;;gCAEjC,qBAAM,GAAG,EAAA;oCADf,wGACK,CAAC,SAAS,CAAC,KACX,UAAU,IAEV,MAAM,CAAC,WAAW,CACnB,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,UAAC,EAAY;4CAAX,GAAG,QAAA,EAAE,KAAK,QAAA;wCAAM,OAAA;4CAC/C,UAAG,IAAA,0BAAkB,EAAC,aAAa,CAAC,WAAW,EAAE,CAAC,cAAI,GAAG,CAAE;4CAC3D,KAAK;yCACN;oCAHgD,CAGhD,CAAC,CACH,IACD;;;qBACH,EACD,OAAO,CAAC,OAAO,CAAC,EAA4B,CAAC,CAC9C,EAAA;;YAxBD,6DAA6D;YAC7D,0EAA0E;YAC1E,mCAAmC;YACnC,sBAAO,SAqBN,EAAC;;;KAEL,CAAC;AAEK,IAAM,cAAc,GAAG,UAAO,MAAc,EAAE,MAAe;;;;oBAChD,qBAAM,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAA;;gBAAxD,SAAS,GAAG,SAA4C;gBAE9D,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC;;;;KAClD,CAAC;AAJW,QAAA,cAAc,kBAIzB;AAEF,IAAM,wBAAwB,GAAG,UAAC,SAAoB;IACpD,OAAA,IAAA,0BAAkB,EAAC,SAAS,EAAE,SAAS,CAAC;AAAxC,CAAwC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/apps/catenv/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Config } from "@catladder/pipeline";
|
|
2
|
+
import type { Choice, Variables } from "./types";
|
|
3
|
+
export declare const getComponentFullPath: (gitRoot: string, config: Config, componentName: string) => string;
|
|
4
|
+
export declare const getCurrentComponentAndEnvFromChoice: (config: Config, choice?: Choice) => Promise<{
|
|
5
|
+
currentComponent: string;
|
|
6
|
+
env: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const makeKeyValueString: (variables: Variables, keyPrefix?: string) => string;
|
|
9
|
+
export declare const sanitizeMultiLine: (variables: Variables) => {
|
|
10
|
+
[k: string]: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const sanitizeEnvVarName: (name: string) => string;
|
|
@@ -0,0 +1,108 @@
|
|
|
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.sanitizeEnvVarName = exports.sanitizeMultiLine = exports.makeKeyValueString = exports.getCurrentComponentAndEnvFromChoice = exports.getComponentFullPath = void 0;
|
|
40
|
+
var path_1 = require("path");
|
|
41
|
+
var projects_1 = require("../../utils/projects");
|
|
42
|
+
var getComponentFullPath = function (gitRoot, config, componentName) {
|
|
43
|
+
return (0, path_1.join)(gitRoot, config.components[componentName].dir);
|
|
44
|
+
};
|
|
45
|
+
exports.getComponentFullPath = getComponentFullPath;
|
|
46
|
+
var getCurrentComponentName = function (config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
+
var gitRoot, currentDir;
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0: return [4 /*yield*/, (0, projects_1.getGitRoot)()];
|
|
51
|
+
case 1:
|
|
52
|
+
gitRoot = _a.sent();
|
|
53
|
+
currentDir = process.cwd();
|
|
54
|
+
return [2 /*return*/, Object.keys(config.components).find(function (c) {
|
|
55
|
+
return currentDir.startsWith((0, exports.getComponentFullPath)(gitRoot, config, c));
|
|
56
|
+
})];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}); };
|
|
60
|
+
var getCurrentComponentAndEnvFromChoice = function (config, choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
61
|
+
var env, currentComponent, _a;
|
|
62
|
+
var _b, _c;
|
|
63
|
+
return __generator(this, function (_d) {
|
|
64
|
+
switch (_d.label) {
|
|
65
|
+
case 0:
|
|
66
|
+
env = (_b = choice === null || choice === void 0 ? void 0 : choice.env) !== null && _b !== void 0 ? _b : "local";
|
|
67
|
+
if (!((_c = choice === null || choice === void 0 ? void 0 : choice.componentName) !== null && _c !== void 0)) return [3 /*break*/, 1];
|
|
68
|
+
_a = _c;
|
|
69
|
+
return [3 /*break*/, 3];
|
|
70
|
+
case 1: return [4 /*yield*/, getCurrentComponentName(config)];
|
|
71
|
+
case 2:
|
|
72
|
+
_a = (_d.sent());
|
|
73
|
+
_d.label = 3;
|
|
74
|
+
case 3:
|
|
75
|
+
currentComponent = _a;
|
|
76
|
+
return [2 /*return*/, {
|
|
77
|
+
currentComponent: currentComponent,
|
|
78
|
+
env: env
|
|
79
|
+
}];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}); };
|
|
83
|
+
exports.getCurrentComponentAndEnvFromChoice = getCurrentComponentAndEnvFromChoice;
|
|
84
|
+
var makeKeyValueString = function (variables, keyPrefix) {
|
|
85
|
+
if (keyPrefix === void 0) { keyPrefix = ""; }
|
|
86
|
+
return Object.entries(variables)
|
|
87
|
+
.map(function (_a) {
|
|
88
|
+
var key = _a[0], value = _a[1];
|
|
89
|
+
return "".concat(keyPrefix).concat(key, "='").concat(value, "'");
|
|
90
|
+
})
|
|
91
|
+
.join("\n");
|
|
92
|
+
};
|
|
93
|
+
exports.makeKeyValueString = makeKeyValueString;
|
|
94
|
+
var sanitizeMultiLine = function (variables) {
|
|
95
|
+
return Object.fromEntries(Object.entries(variables).map(function (_a) {
|
|
96
|
+
var key = _a[0], value = _a[1];
|
|
97
|
+
return [
|
|
98
|
+
key,
|
|
99
|
+
value.replaceAll("\n", "\\n"),
|
|
100
|
+
];
|
|
101
|
+
}));
|
|
102
|
+
};
|
|
103
|
+
exports.sanitizeMultiLine = sanitizeMultiLine;
|
|
104
|
+
var sanitizeEnvVarName = function (name) {
|
|
105
|
+
return name.replace(/[\s\-.]+/g, "_");
|
|
106
|
+
};
|
|
107
|
+
exports.sanitizeEnvVarName = sanitizeEnvVarName;
|
|
108
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/apps/catenv/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6BAA4B;AAC5B,iDAAkD;AAE3C,IAAM,oBAAoB,GAAG,UAClC,OAAe,EACf,MAAc,EACd,aAAqB;IAErB,OAAO,IAAA,WAAI,EAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC;AAC7D,CAAC,CAAC;AANW,QAAA,oBAAoB,wBAM/B;AACF,IAAM,uBAAuB,GAAG,UAAO,MAAc;;;;oBACnC,qBAAM,IAAA,qBAAU,GAAE,EAAA;;gBAA5B,OAAO,GAAG,SAAkB;gBAC5B,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;gBACjC,sBAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,UAAC,CAAC;wBAC3C,OAAA,UAAU,CAAC,UAAU,CAAC,IAAA,4BAAoB,EAAC,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;oBAA/D,CAA+D,CAChE,EAAC;;;KACH,CAAC;AAEK,IAAM,mCAAmC,GAAG,UACjD,MAAc,EACd,MAAe;;;;;;gBAET,GAAG,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,mCAAI,OAAO,CAAC;4BAEjC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa;;;oBAAK,qBAAM,uBAAuB,CAAC,MAAM,CAAC,EAAA;;gBAAtC,KAAA,CAAC,SAAqC,CAAC,CAAA;;;gBAD5D,gBAAgB,KAC4C;gBAElE,sBAAO;wBACL,gBAAgB,kBAAA;wBAChB,GAAG,KAAA;qBACJ,EAAC;;;KACH,CAAC;AAZW,QAAA,mCAAmC,uCAY9C;AAEK,IAAM,kBAAkB,GAAG,UAAC,SAAoB,EAAE,SAAc;IAAd,0BAAA,EAAA,cAAc;IACrE,OAAA,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;SACtB,GAAG,CAAC,UAAC,EAAY;YAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QAAM,OAAA,UAAG,SAAS,SAAG,GAAG,eAAK,KAAK,MAAG;IAA/B,CAA+B,CAAC;SACtD,IAAI,CAAC,IAAI,CAAC;AAFb,CAEa,CAAC;AAHH,QAAA,kBAAkB,sBAGf;AAET,IAAM,iBAAiB,GAAG,UAAC,SAAoB;IACpD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,UAAC,EAAY;YAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QAAM,OAAA;YAC9C,GAAG;YACH,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC;SAC9B;IAH+C,CAG/C,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B;AAEK,IAAM,kBAAkB,GAAG,UAAC,IAAY;IAC7C,OAAA,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC;AAA9B,CAA8B,CAAC;AADpB,QAAA,kBAAkB,sBACE"}
|
|
@@ -0,0 +1,94 @@
|
|
|
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.writeDotEnvFiles = void 0;
|
|
40
|
+
var fs_extra_1 = require("fs-extra");
|
|
41
|
+
var path_1 = require("path");
|
|
42
|
+
var getProjectConfig_1 = require("../../config/getProjectConfig");
|
|
43
|
+
var projects_1 = require("../../utils/projects");
|
|
44
|
+
var utils_1 = require("./utils");
|
|
45
|
+
var writeDotEnvFiles = function (config, choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
+
var _a, env, currentComponent, componentsWithEnabledDotEnvWrite, componentsToActuallyWriteDotEnvNow, gitRoot, _i, componentsToActuallyWriteDotEnvNow_1, componentName, variables, componentDir, filePath, variablesSanitized;
|
|
47
|
+
return __generator(this, function (_b) {
|
|
48
|
+
switch (_b.label) {
|
|
49
|
+
case 0: return [4 /*yield*/, (0, utils_1.getCurrentComponentAndEnvFromChoice)(config, choice)];
|
|
50
|
+
case 1:
|
|
51
|
+
_a = _b.sent(), env = _a.env, currentComponent = _a.currentComponent;
|
|
52
|
+
componentsWithEnabledDotEnvWrite = Object.entries(config.components)
|
|
53
|
+
.filter(function (_a) {
|
|
54
|
+
var component = _a[1];
|
|
55
|
+
return component === null || component === void 0 ? void 0 : component.dotEnv;
|
|
56
|
+
})
|
|
57
|
+
.map(function (_a) {
|
|
58
|
+
var componentName = _a[0];
|
|
59
|
+
return componentName;
|
|
60
|
+
});
|
|
61
|
+
componentsToActuallyWriteDotEnvNow = currentComponent
|
|
62
|
+
? componentsWithEnabledDotEnvWrite.includes(currentComponent)
|
|
63
|
+
? [currentComponent]
|
|
64
|
+
: []
|
|
65
|
+
: componentsWithEnabledDotEnvWrite;
|
|
66
|
+
return [4 /*yield*/, (0, projects_1.getGitRoot)()];
|
|
67
|
+
case 2:
|
|
68
|
+
gitRoot = _b.sent();
|
|
69
|
+
_i = 0, componentsToActuallyWriteDotEnvNow_1 = componentsToActuallyWriteDotEnvNow;
|
|
70
|
+
_b.label = 3;
|
|
71
|
+
case 3:
|
|
72
|
+
if (!(_i < componentsToActuallyWriteDotEnvNow_1.length)) return [3 /*break*/, 7];
|
|
73
|
+
componentName = componentsToActuallyWriteDotEnvNow_1[_i];
|
|
74
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(null, env, componentName)];
|
|
75
|
+
case 4:
|
|
76
|
+
variables = _b.sent();
|
|
77
|
+
delete variables["_ALL_ENV_VAR_KEYS"];
|
|
78
|
+
componentDir = (0, utils_1.getComponentFullPath)(gitRoot, config, componentName);
|
|
79
|
+
filePath = (0, path_1.join)(componentDir, ".env");
|
|
80
|
+
variablesSanitized = (0, utils_1.sanitizeMultiLine)(variables);
|
|
81
|
+
return [4 /*yield*/, (0, fs_extra_1.writeFile)(filePath, "# automatically created by catladder. Do not modify!\n\n" +
|
|
82
|
+
(0, utils_1.makeKeyValueString)(variablesSanitized))];
|
|
83
|
+
case 5:
|
|
84
|
+
_b.sent();
|
|
85
|
+
_b.label = 6;
|
|
86
|
+
case 6:
|
|
87
|
+
_i++;
|
|
88
|
+
return [3 /*break*/, 3];
|
|
89
|
+
case 7: return [2 /*return*/];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}); };
|
|
93
|
+
exports.writeDotEnvFiles = writeDotEnvFiles;
|
|
94
|
+
//# sourceMappingURL=writeDotEnvFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeDotEnvFiles.js","sourceRoot":"","sources":["../../../src/apps/catenv/writeDotEnvFiles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAqC;AACrC,6BAA4B;AAC5B,kEAAmE;AACnE,iDAAkD;AAElD,iCAKiB;AAEV,IAAM,gBAAgB,GAAG,UAAO,MAAc,EAAE,MAAe;;;;oBAClC,qBAAM,IAAA,2CAAmC,EACzE,MAAM,EACN,MAAM,CACP,EAAA;;gBAHK,KAA4B,SAGjC,EAHO,GAAG,SAAA,EAAE,gBAAgB,sBAAA;gBAKvB,gCAAgC,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;qBACvE,MAAM,CAAC,UAAC,EAAa;wBAAV,SAAS,QAAA;oBAAM,OAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM;gBAAjB,CAAiB,CAAC;qBAC5C,GAAG,CAAC,UAAC,EAAe;wBAAd,aAAa,QAAA;oBAAM,OAAA,aAAa;gBAAb,CAAa,CAAC,CAAC;gBAErC,kCAAkC,GAAG,gBAAgB;oBACzD,CAAC,CAAC,gCAAgC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;wBAC3D,CAAC,CAAC,CAAC,gBAAgB,CAAC;wBACpB,CAAC,CAAC,EAAE;oBACN,CAAC,CAAC,gCAAgC,CAAC;gBACrB,qBAAM,IAAA,qBAAU,GAAE,EAAA;;gBAA5B,OAAO,GAAG,SAAkB;sBAE4B,EAAlC,yEAAkC;;;qBAAlC,CAAA,gDAAkC,CAAA;gBAAnD,aAAa;gBACJ,qBAAM,IAAA,qCAAkB,EAAC,IAAI,EAAE,GAAG,EAAE,aAAa,CAAC,EAAA;;gBAA9D,SAAS,GAAG,SAAkD;gBACpE,OAAO,SAAS,CAAC,mBAAmB,CAAC,CAAC;gBAChC,YAAY,GAAG,IAAA,4BAAoB,EAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;gBACpE,QAAQ,GAAG,IAAA,WAAI,EAAC,YAAY,EAAE,MAAM,CAAC,CAAC;gBAEtC,kBAAkB,GAAG,IAAA,yBAAiB,EAAC,SAAS,CAAC,CAAC;gBACxD,qBAAM,IAAA,oBAAS,EACb,QAAQ,EACR,0DAA0D;wBACxD,IAAA,0BAAkB,EAAC,kBAAkB,CAAC,CACzC,EAAA;;gBAJD,SAIC,CAAC;;;gBAXwB,IAAkC,CAAA;;;;;KAa/D,CAAC;AA9BW,QAAA,gBAAgB,oBA8B3B"}
|
|
@@ -0,0 +1,114 @@
|
|
|
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.writeDTsFiles = void 0;
|
|
40
|
+
var fs_extra_1 = require("fs-extra");
|
|
41
|
+
var path_1 = require("path");
|
|
42
|
+
var getProjectConfig_1 = require("../../config/getProjectConfig");
|
|
43
|
+
var projects_1 = require("../../utils/projects");
|
|
44
|
+
var utils_1 = require("./utils");
|
|
45
|
+
var writeDTsFiles = function (config, choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
+
var _a, env, currentComponent, componentsWithEnabledEnvDTsWrite, componentsToActuallyWriteEnvDts, gitRoot, _i, componentsToActuallyWriteEnvDts_1, componentName, envNames, envDTsContent, componentDir, filePath;
|
|
47
|
+
return __generator(this, function (_b) {
|
|
48
|
+
switch (_b.label) {
|
|
49
|
+
case 0: return [4 /*yield*/, (0, utils_1.getCurrentComponentAndEnvFromChoice)(config, choice)];
|
|
50
|
+
case 1:
|
|
51
|
+
_a = _b.sent(), env = _a.env, currentComponent = _a.currentComponent;
|
|
52
|
+
componentsWithEnabledEnvDTsWrite = Object.entries(config.components)
|
|
53
|
+
.filter(function (_a) {
|
|
54
|
+
var component = _a[1];
|
|
55
|
+
return component === null || component === void 0 ? void 0 : component.envDTs;
|
|
56
|
+
})
|
|
57
|
+
.map(function (_a) {
|
|
58
|
+
var componentName = _a[0];
|
|
59
|
+
return componentName;
|
|
60
|
+
});
|
|
61
|
+
componentsToActuallyWriteEnvDts = currentComponent
|
|
62
|
+
? componentsWithEnabledEnvDTsWrite.includes(currentComponent)
|
|
63
|
+
? [currentComponent]
|
|
64
|
+
: []
|
|
65
|
+
: componentsWithEnabledEnvDTsWrite;
|
|
66
|
+
return [4 /*yield*/, (0, projects_1.getGitRoot)()];
|
|
67
|
+
case 2:
|
|
68
|
+
gitRoot = _b.sent();
|
|
69
|
+
_i = 0, componentsToActuallyWriteEnvDts_1 = componentsToActuallyWriteEnvDts;
|
|
70
|
+
_b.label = 3;
|
|
71
|
+
case 3:
|
|
72
|
+
if (!(_i < componentsToActuallyWriteEnvDts_1.length)) return [3 /*break*/, 7];
|
|
73
|
+
componentName = componentsToActuallyWriteEnvDts_1[_i];
|
|
74
|
+
return [4 /*yield*/, getEnvsForDTs(env, componentName)];
|
|
75
|
+
case 4:
|
|
76
|
+
envNames = _b.sent();
|
|
77
|
+
envDTsContent = createEnvDTsContent(envNames);
|
|
78
|
+
componentDir = (0, utils_1.getComponentFullPath)(gitRoot, config, componentName);
|
|
79
|
+
filePath = (0, path_1.join)(componentDir, "env.d.ts");
|
|
80
|
+
return [4 /*yield*/, (0, fs_extra_1.writeFile)(filePath, envDTsContent)];
|
|
81
|
+
case 5:
|
|
82
|
+
_b.sent();
|
|
83
|
+
_b.label = 6;
|
|
84
|
+
case 6:
|
|
85
|
+
_i++;
|
|
86
|
+
return [3 /*break*/, 3];
|
|
87
|
+
case 7: return [2 /*return*/];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}); };
|
|
91
|
+
exports.writeDTsFiles = writeDTsFiles;
|
|
92
|
+
function getEnvsForDTs(env, componentName) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
+
var environment, allEnvKeys, hiddenEnvKeys, dTsEnvKeys;
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
switch (_a.label) {
|
|
97
|
+
case 0: return [4 /*yield*/, (0, getProjectConfig_1.getEnvironment)(env, componentName)];
|
|
98
|
+
case 1:
|
|
99
|
+
environment = _a.sent();
|
|
100
|
+
allEnvKeys = Object.keys(environment.envVars);
|
|
101
|
+
hiddenEnvKeys = new Set(environment.secretEnvVarKeys
|
|
102
|
+
.filter(function (s) { return s.hidden; })
|
|
103
|
+
.map(function (s) { return s.key; })
|
|
104
|
+
.concat(["_ALL_ENV_VAR_KEYS"]));
|
|
105
|
+
dTsEnvKeys = allEnvKeys.filter(function (k) { return !hiddenEnvKeys.has(k); });
|
|
106
|
+
return [2 /*return*/, dTsEnvKeys];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function createEnvDTsContent(envNames) {
|
|
112
|
+
return "/* tslint:disable prettier/prettier */\n/* eslint-disable prettier/prettier */\n/* prettier-ignore */\n// automatically generated by catladder. Do not modify!\nexport {}\n\ndeclare global {\n namespace NodeJS {\n interface ProcessEnv {\n".concat(envNames.map(function (name) { return " ".concat(name, ": string"); }).join("\n"), "\n }\n }\n}\n");
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=writeEnvDTs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeEnvDTs.js","sourceRoot":"","sources":["../../../src/apps/catenv/writeEnvDTs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAqC;AACrC,6BAA4B;AAC5B,kEAA+D;AAC/D,iDAAkD;AAElD,iCAGiB;AAEV,IAAM,aAAa,GAAG,UAAO,MAAc,EAAE,MAAe;;;;oBAC/B,qBAAM,IAAA,2CAAmC,EACzE,MAAM,EACN,MAAM,CACP,EAAA;;gBAHK,KAA4B,SAGjC,EAHO,GAAG,SAAA,EAAE,gBAAgB,sBAAA;gBAKvB,gCAAgC,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;qBACvE,MAAM,CAAC,UAAC,EAAa;wBAAV,SAAS,QAAA;oBAAM,OAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM;gBAAjB,CAAiB,CAAC;qBAC5C,GAAG,CAAC,UAAC,EAAe;wBAAd,aAAa,QAAA;oBAAM,OAAA,aAAa;gBAAb,CAAa,CAAC,CAAC;gBAErC,+BAA+B,GAAG,gBAAgB;oBACtD,CAAC,CAAC,gCAAgC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;wBAC3D,CAAC,CAAC,CAAC,gBAAgB,CAAC;wBACpB,CAAC,CAAC,EAAE;oBACN,CAAC,CAAC,gCAAgC,CAAC;gBACrB,qBAAM,IAAA,qBAAU,GAAE,EAAA;;gBAA5B,OAAO,GAAG,SAAkB;sBAEyB,EAA/B,mEAA+B;;;qBAA/B,CAAA,6CAA+B,CAAA;gBAAhD,aAAa;gBACL,qBAAM,aAAa,CAAC,GAAG,EAAE,aAAa,CAAC,EAAA;;gBAAlD,QAAQ,GAAG,SAAuC;gBAClD,aAAa,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;gBAE9C,YAAY,GAAG,IAAA,4BAAoB,EAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;gBACpE,QAAQ,GAAG,IAAA,WAAI,EAAC,YAAY,EAAE,UAAU,CAAC,CAAC;gBAChD,qBAAM,IAAA,oBAAS,EAAC,QAAQ,EAAE,aAAa,CAAC,EAAA;;gBAAxC,SAAwC,CAAC;;;gBANf,IAA+B,CAAA;;;;;KAQ5D,CAAC;AAzBW,QAAA,aAAa,iBAyBxB;AAEF,SAAe,aAAa,CAC1B,GAAW,EACX,aAAqB;;;;;wBAED,qBAAM,IAAA,iCAAc,EAAC,GAAG,EAAE,aAAa,CAAC,EAAA;;oBAAtD,WAAW,GAAG,SAAwC;oBACtD,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;oBAC9C,aAAa,GAAG,IAAI,GAAG,CAC3B,WAAW,CAAC,gBAAgB;yBACzB,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,MAAM,EAAR,CAAQ,CAAC;yBACvB,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,GAAG,EAAL,CAAK,CAAC;yBACjB,MAAM,CAAC,CAAC,mBAAmB,CAAC,CAAC,CACjC,CAAC;oBACI,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAArB,CAAqB,CAAC,CAAC;oBAEnE,sBAAO,UAAU,EAAC;;;;CACnB;AAED,SAAS,mBAAmB,CAAC,QAAkB;IAC7C,OAAO,2PASP,QAAQ,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,gBAAS,IAAI,aAAU,EAAvB,CAAuB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,sBAI3D,CAAC;AACF,CAAC"}
|