@catladder/cli 0.0.0-waitfor-deploy-31ebcf14 → 0.0.0-yarn-cache-a697966f
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/CONTRIBUTING.md +17 -12
- package/README.md +19 -12
- package/bin/catenv +1 -1
- package/bin/catenv-dev +3 -0
- package/bin/catladder +1 -1
- package/bin/catladder-dev +3 -0
- package/dist/apps/catenv/catenv.d.ts +2 -4
- package/dist/apps/catenv/catenv.js +12 -89
- package/dist/apps/catenv/catenv.js.map +1 -1
- 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.js +4 -2
- package/dist/apps/cli/cli.js.map +1 -1
- package/dist/apps/cli/commands/{project/commandCopyDB.d.ts → cloudSQL/commandRestoreDb.d.ts} +1 -1
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js +185 -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 +1 -1
- package/dist/apps/cli/commands/general/index.js +11 -11
- package/dist/apps/cli/commands/general/index.js.map +1 -1
- package/dist/apps/cli/commands/general/portForward.d.ts +1 -1
- package/dist/apps/cli/commands/general/portForward.js +3 -3
- package/dist/apps/cli/commands/general/portForward.js.map +1 -1
- package/dist/apps/cli/commands/mongodb/index.d.ts +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +2 -1
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +27 -11
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -1
- package/dist/apps/cli/commands/mongodb/utils/index.js +16 -4
- package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -1
- package/dist/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.d.ts +3 -0
- package/dist/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js +189 -0
- package/dist/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js.map +1 -0
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +89 -62
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
- package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +2 -1
- package/dist/apps/cli/commands/project/commandConfigSecrets.js +71 -57
- package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -1
- package/dist/apps/cli/commands/project/commandDeletePods.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandDeletePods.js +2 -1
- package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -1
- package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandEnvVars.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandEnvVars.js +1 -1
- package/dist/apps/cli/commands/project/commandEnvVars.js.map +1 -1
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +1 -1
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +1 -1
- package/dist/apps/cli/commands/project/commandGetShell.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandGetShell.js +10 -6
- package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -1
- package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -1
- package/dist/apps/cli/commands/project/commandInitProject.old.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandListPods.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandListPods.js +2 -2
- package/dist/apps/cli/commands/project/commandListPods.js.map +1 -1
- package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandMigrateHelm3.js +1 -2
- package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +1 -1
- package/dist/apps/cli/commands/project/commandNamespace.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +2 -2
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +1 -1
- package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenDashboard.js +19 -20
- package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -1
- package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenGit.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenGit.js +2 -7
- package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -1
- package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenGrafana.js +2 -2
- package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +1 -1
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +4 -3
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -1
- package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenLogs.js +7 -20
- package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -1
- package/dist/apps/cli/commands/project/commandPauseProject.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandPortForward.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandPortForward.js +98 -36
- package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -1
- 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 +1 -1
- package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -1
- package/dist/apps/cli/commands/project/index.d.ts +1 -1
- package/dist/apps/cli/commands/project/index.js +4 -2
- package/dist/apps/cli/commands/project/index.js.map +1 -1
- package/dist/apps/cli/commands/project/setup/index.d.ts +1 -1
- package/dist/apps/cli/commands/project/setup/index.js +11 -7
- package/dist/apps/cli/commands/project/setup/index.js.map +1 -1
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.d.ts +1 -1
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js +5 -4
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
- 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 +2 -2
- package/dist/apps/cli/commands/project/setup/setupContext.js +10 -3
- package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -1
- package/dist/apps/cli/commands/project/setup/setupKubernetes.d.ts +2 -2
- package/dist/apps/cli/commands/project/setup/setupKubernetes.js +25 -18
- package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
- 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/ensureNamespace.d.ts +1 -1
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
- package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +1 -1
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +1 -1
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +1 -1
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -1
- package/dist/apps/cli/config/writeConfig.d.ts +2 -2
- package/dist/apps/cli/verify/index.d.ts +1 -1
- package/dist/apps/cli/verify/migration/fromv2.d.ts +1 -1
- package/dist/apps/cli/verify/migration/fromv2.js +2 -0
- package/dist/apps/cli/verify/migration/fromv2.js.map +1 -1
- package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +3 -3
- package/dist/apps/cli/verify/migration/migrateSecrets.js +6 -3
- package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -1
- package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +1 -1
- package/dist/apps/cli/verify/migration/oldGitlabCi.js +1 -1
- package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -1
- package/dist/bundles/catenv/index.js +46611 -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 +363653 -0
- package/dist/bundles/cli/xdg-open +1066 -0
- package/dist/bundles/cli/xsel +0 -0
- package/dist/catenv.js +2 -4
- package/dist/catenv.js.map +1 -1
- package/dist/cli.js +0 -7
- package/dist/cli.js.map +1 -1
- package/dist/config/constants.d.ts +0 -1
- package/dist/config/constants.js +1 -2
- package/dist/config/constants.js.map +1 -1
- package/dist/config/getProjectConfig.d.ts +10 -10
- package/dist/config/getProjectConfig.js +77 -23
- package/dist/config/getProjectConfig.js.map +1 -1
- 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/copyDb.d.ts +12 -0
- package/dist/gcloud/cloudSql/copyDb.js +64 -0
- package/dist/gcloud/cloudSql/copyDb.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/{apps/cli/commands/shared/index.js → gcloud/openDashboard.js} +23 -27
- 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/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/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/cluster.js +3 -8
- package/dist/utils/cluster.js.map +1 -1
- package/dist/utils/gitlab.d.ts +8 -6
- package/dist/utils/gitlab.js +165 -46
- package/dist/utils/gitlab.js.map +1 -1
- package/dist/utils/passwordstore/index.d.ts +0 -1
- package/dist/utils/passwordstore/index.js +1 -64
- package/dist/utils/passwordstore/index.js.map +1 -1
- package/dist/utils/portForwards.d.ts +12 -0
- package/dist/utils/{portForward.js → portForwards.js} +20 -16
- package/dist/utils/portForwards.js.map +1 -0
- package/dist/utils/projects/index.d.ts +0 -3
- package/dist/utils/projects/index.js +3 -53
- package/dist/utils/projects/index.js.map +1 -1
- package/package.json +73 -22
- package/scripts/bundle +4 -0
- package/src/apps/catenv/catenv.ts +11 -62
- 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/cli/cli.ts +3 -1
- package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +136 -0
- package/src/apps/cli/commands/cloudSQL/index.ts +8 -0
- package/src/apps/cli/commands/general/index.ts +11 -8
- package/src/apps/cli/commands/general/portForward.ts +4 -4
- package/src/apps/cli/commands/mongodb/index.ts +1 -1
- package/src/apps/cli/commands/mongodb/projectMongoDestroyMember.ts +3 -5
- package/src/apps/cli/commands/mongodb/projectMongoGetShell.ts +1 -1
- package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +21 -3
- package/src/apps/cli/commands/mongodb/utils/index.ts +19 -11
- package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +175 -0
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +106 -55
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +49 -35
- package/src/apps/cli/commands/project/commandDeletePods.ts +3 -5
- package/src/apps/cli/commands/project/commandDeleteProject.ts +1 -1
- package/src/apps/cli/commands/project/commandEnvVars.ts +6 -3
- package/src/apps/cli/commands/project/commandGetMyTotalWorktime.ts +2 -2
- package/src/apps/cli/commands/project/commandGetShell.ts +10 -9
- package/src/apps/cli/commands/project/commandGitlabCi.ts +2 -1
- package/src/apps/cli/commands/project/commandInitProject.old.ts +1 -1
- package/src/apps/cli/commands/project/commandListPods.ts +2 -2
- package/src/apps/cli/commands/project/commandMigrateHelm3.ts +4 -3
- package/src/apps/cli/commands/project/commandNamespace.ts +1 -1
- package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +3 -3
- package/src/apps/cli/commands/project/commandOpenDashboard.ts +12 -32
- package/src/apps/cli/commands/project/commandOpenEnv.ts +1 -1
- package/src/apps/cli/commands/project/commandOpenGit.ts +3 -3
- package/src/apps/cli/commands/project/commandOpenGrafana.ts +3 -3
- package/src/apps/cli/commands/project/commandOpenGrafanaPod.ts +5 -7
- package/src/apps/cli/commands/project/commandOpenLogs.ts +4 -35
- package/src/apps/cli/commands/project/commandPauseProject.ts +1 -1
- package/src/apps/cli/commands/project/commandPortForward.ts +75 -34
- package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +27 -0
- package/src/apps/cli/commands/project/commandSetup.ts +1 -1
- package/src/apps/cli/commands/project/commandTriggerCronjob.ts +3 -2
- package/src/apps/cli/commands/project/index.ts +6 -3
- package/src/apps/cli/commands/project/setup/index.ts +3 -1
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +23 -11
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +84 -0
- package/src/apps/cli/commands/project/setup/setupContext.ts +9 -2
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +56 -28
- package/src/apps/cli/commands/project/setup/setupTopic.ts +22 -0
- package/src/apps/cli/commands/project/utils/ensureNamespace.ts +4 -2
- package/src/apps/cli/commands/project/utils/showProjectBanner.ts +1 -1
- package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +2 -2
- package/src/apps/cli/config/writeConfig.ts +2 -2
- package/src/apps/cli/verify/index.ts +1 -1
- package/src/apps/cli/verify/migration/fromv2.ts +5 -7
- package/src/apps/cli/verify/migration/migrateSecrets.ts +15 -5
- package/src/apps/cli/verify/migration/oldGitlabCi.ts +2 -2
- package/src/catenv.ts +3 -4
- package/src/cli.ts +1 -7
- package/src/config/constants.ts +0 -2
- package/src/config/getProjectConfig.ts +71 -31
- 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/copyDb.ts +57 -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/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/utils/cluster.ts +3 -3
- package/src/utils/gitlab.ts +141 -30
- package/src/utils/passwordstore/index.ts +2 -30
- package/src/utils/{portForward.ts → portForwards.ts} +27 -22
- package/src/utils/projects/index.ts +3 -24
- package/tsconfig.json +1 -1
- package/dist/apps/cli/commands/project/commandCopyDB.js +0 -102
- package/dist/apps/cli/commands/project/commandCopyDB.js.map +0 -1
- package/dist/apps/cli/commands/shared/index.d.ts +0 -3
- package/dist/apps/cli/commands/shared/index.js.map +0 -1
- package/dist/utils/portForward.d.ts +0 -4
- package/dist/utils/portForward.js.map +0 -1
- package/src/apps/cli/commands/project/commandCopyDB.ts +0 -91
- package/src/apps/cli/commands/shared/index.ts +0 -36
package/CONTRIBUTING.md
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
#### Atomic commits
|
|
4
4
|
|
|
5
|
-
If possible, make [atomic commits](https://en.wikipedia.org/wiki/Atomic_commit), which means:
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
5
|
+
If possible, make [atomic commits](https://en.wikipedia.org/wiki/Atomic_commit), which means that a commit should:
|
|
6
|
+
|
|
7
|
+
- Contain exactly one self-contained functional change
|
|
8
|
+
- Not depend on changes in one of your later commits
|
|
9
|
+
- Not create an inconsistent state (such as test errors, linting errors, partial fix, feature with documentation etc…)
|
|
9
10
|
|
|
10
11
|
A complex feature can be broken down into multiple commits as long as each one maintains a consistent state and consists of a self-contained change.
|
|
11
12
|
|
|
@@ -27,7 +28,8 @@ The **footer** can contain a [closing reference to an issue](https://help.github
|
|
|
27
28
|
|
|
28
29
|
#### Revert
|
|
29
30
|
|
|
30
|
-
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit.
|
|
31
|
+
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit.
|
|
32
|
+
In the body, it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
|
|
31
33
|
|
|
32
34
|
#### Type
|
|
33
35
|
|
|
@@ -42,25 +44,28 @@ The type must be one of the following:
|
|
|
42
44
|
| **fix** | A bug fix |
|
|
43
45
|
| **perf** | A code change that improves performance |
|
|
44
46
|
| **refactor** | A code change that neither fixes a bug nor adds a feature |
|
|
45
|
-
| **style** | Changes that do not affect the meaning of the code (white-space, formatting, missing
|
|
47
|
+
| **style** | Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc) |
|
|
46
48
|
| **test** | Adding missing tests or correcting existing tests |
|
|
47
49
|
|
|
48
50
|
#### Subject
|
|
49
51
|
|
|
50
|
-
The subject contains succinct description of the change:
|
|
52
|
+
The subject contains a succinct description of the change:
|
|
51
53
|
|
|
52
54
|
- use the imperative, present tense: "change" not "changed" nor "changes"
|
|
53
|
-
- don't capitalize first letter
|
|
55
|
+
- don't capitalize the first letter
|
|
54
56
|
- no dot (.) at the end
|
|
55
57
|
|
|
56
58
|
#### Body
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
|
|
60
|
+
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
|
|
61
|
+
The body should include the motivation for the change and contrast this with previous behaviour.
|
|
59
62
|
|
|
60
63
|
#### Footer
|
|
64
|
+
|
|
61
65
|
The footer should contain any information about **Breaking Changes** and is also the place to reference GitLab issues that this commit **Closes**.
|
|
62
66
|
|
|
63
|
-
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines.
|
|
67
|
+
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines.
|
|
68
|
+
The rest of the commit message is then used for this.
|
|
64
69
|
|
|
65
70
|
#### Examples
|
|
66
71
|
|
|
@@ -80,4 +85,4 @@ perf(pencil): remove graphiteWidth option`
|
|
|
80
85
|
BREAKING CHANGE: The graphiteWidth option has been removed.
|
|
81
86
|
|
|
82
87
|
The default graphite width of 10mm is always used for performance reasons.
|
|
83
|
-
```
|
|
88
|
+
```
|
package/README.md
CHANGED
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
# catladder 🐱 🔧
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Panter cli tool for Kubernetes.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```sh
|
|
8
|
+
# yarn users
|
|
9
|
+
yarn global add @catladder/cli
|
|
10
|
+
# npm users
|
|
11
|
+
npm install -g @catladder/cli
|
|
12
|
+
```
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
|
|
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`_
|
|
14
|
+
> **Note**: If you have [@catladder/pipeline](https://www.npmjs.com/package/@catladder/pipeline) installed, upgrade it to >=4.0.0 before installing [@catladder/cli](https://www.npmjs.com/package/@catladder/cli).
|
|
14
15
|
|
|
15
16
|
## Getting started
|
|
16
17
|
|
|
17
|
-
You'll need
|
|
18
|
+
You'll need:
|
|
18
19
|
|
|
19
20
|
- Google Cloud SDK ([see installation instructions](https://cloud.google.com/sdk/docs/install))
|
|
20
21
|
- Kubectl ([see installation instructions](https://kubernetes.io/docs/tasks/tools/))
|
|
21
22
|
- Cloud SQL Auth proxy ([see installation instructions](https://cloud.google.com/sql/docs/postgres/sql-proxy#install))
|
|
22
23
|
|
|
23
|
-
Afterwards you need to connect to your cluster, e.g. `gcloud container clusters get-credentials clustername --zone google-zone --project google-project-id`
|
|
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)
|
|
24
|
+
Afterwards, you need to connect to your cluster, e.g. `gcloud container clusters get-credentials clustername --zone google-zone --project google-project-id`
|
|
25
|
+
In most cases, you'll find the details on the Google Cloud [cluster overview ](https://console.cloud.google.com/kubernetes/list?project=skynet-164509)
|
|
25
26
|
|
|
26
27
|
It just works™
|
|
27
28
|
|
|
28
29
|
## Preferences
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
Catladder stores some preferences in `~/.catladder/preferences.yml` in case you want to change settings.
|
|
31
32
|
|
|
32
33
|
## Contribution
|
|
33
34
|
|
|
34
|
-
Check the
|
|
35
|
+
Check the documentation [here](https://git.panter.ch/catladder/catladder/-/tree/main/cli/CONTRIBUTING.md).
|
|
36
|
+
|
|
37
|
+
### Adding packages in cli
|
|
38
|
+
|
|
39
|
+
if you add npm libs in cli, make sure to add them as dev-dependencies.
|
|
40
|
+
|
|
41
|
+
the reason is that we bundle all dependencies in the cli package, so that if you add that to your project, it won't install all @catladder/cli's dependencies.
|
package/bin/catenv
CHANGED
package/bin/catenv-dev
ADDED
package/bin/catladder
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
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
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -48,77 +37,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
37
|
};
|
|
49
38
|
exports.__esModule = true;
|
|
50
39
|
var getProjectConfig_1 = require("../../config/getProjectConfig");
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
var gitRoot, currentDir;
|
|
55
|
-
return __generator(this, function (_a) {
|
|
56
|
-
switch (_a.label) {
|
|
57
|
-
case 0: return [4 /*yield*/, (0, projects_1.getGitRoot)()];
|
|
58
|
-
case 1:
|
|
59
|
-
gitRoot = _a.sent();
|
|
60
|
-
currentDir = process.cwd();
|
|
61
|
-
return [2 /*return*/, Object.keys(components).find(function (c) {
|
|
62
|
-
return currentDir.startsWith((0, path_1.join)(gitRoot, components[c].dir));
|
|
63
|
-
})];
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}); };
|
|
67
|
-
var sanitizeEnvVarName = function (name) { return name.replace(/[\s\-.]+/g, "_"); };
|
|
68
|
-
var getAllVariablesToPrint = function (config, choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
69
|
-
var env, components, currentComponent, _a, variables;
|
|
70
|
-
var _b, _c;
|
|
71
|
-
return __generator(this, function (_d) {
|
|
72
|
-
switch (_d.label) {
|
|
73
|
-
case 0:
|
|
74
|
-
env = (_b = choice === null || choice === void 0 ? void 0 : choice.env) !== null && _b !== void 0 ? _b : "local";
|
|
75
|
-
components = config.components;
|
|
76
|
-
if (!((_c = choice === null || choice === void 0 ? void 0 : choice.componentName) !== null && _c !== void 0)) return [3 /*break*/, 1];
|
|
77
|
-
_a = _c;
|
|
78
|
-
return [3 /*break*/, 3];
|
|
79
|
-
case 1: return [4 /*yield*/, getCurrentComponentName(components)];
|
|
80
|
-
case 2:
|
|
81
|
-
_a = (_d.sent());
|
|
82
|
-
_d.label = 3;
|
|
83
|
-
case 3:
|
|
84
|
-
currentComponent = _a;
|
|
85
|
-
variables = {};
|
|
86
|
-
if (!currentComponent) return [3 /*break*/, 5];
|
|
87
|
-
return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(null, env, currentComponent)];
|
|
88
|
-
case 4:
|
|
89
|
-
variables = _d.sent();
|
|
90
|
-
return [3 /*break*/, 7];
|
|
91
|
-
case 5: return [4 /*yield*/, Object.keys(components).reduce(function (acc, componentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
92
|
-
var subappvars, _a;
|
|
93
|
-
return __generator(this, function (_b) {
|
|
94
|
-
switch (_b.label) {
|
|
95
|
-
case 0: return [4 /*yield*/, (0, getProjectConfig_1.getEnvVars)(null, env, componentName)];
|
|
96
|
-
case 1:
|
|
97
|
-
subappvars = _b.sent();
|
|
98
|
-
_a = [{}];
|
|
99
|
-
return [4 /*yield*/, acc];
|
|
100
|
-
case 2: 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) {
|
|
101
|
-
var key = _a[0], value = _a[1];
|
|
102
|
-
return [
|
|
103
|
-
"".concat(sanitizeEnvVarName(componentName.toUpperCase()), "_").concat(key),
|
|
104
|
-
value,
|
|
105
|
-
];
|
|
106
|
-
}))])];
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}); }, {})];
|
|
110
|
-
case 6:
|
|
111
|
-
// when in a monorep and not in a subapp, merge all env vars.
|
|
112
|
-
// this is not 100% correct, but better than not exporting any vars at all
|
|
113
|
-
// so we also add prefixed variants
|
|
114
|
-
variables = _d.sent();
|
|
115
|
-
_d.label = 7;
|
|
116
|
-
case 7: return [2 /*return*/, variables];
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}); };
|
|
40
|
+
var printVariables_1 = require("./printVariables");
|
|
41
|
+
var writeDotEnvFiles_1 = require("./writeDotEnvFiles");
|
|
42
|
+
var writeEnvDTs_1 = require("./writeEnvDTs");
|
|
120
43
|
exports["default"] = (function (choice) { return __awaiter(void 0, void 0, void 0, function () {
|
|
121
|
-
var config
|
|
44
|
+
var config;
|
|
122
45
|
return __generator(this, function (_a) {
|
|
123
46
|
switch (_a.label) {
|
|
124
47
|
case 0: return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
|
|
@@ -127,15 +50,15 @@ exports["default"] = (function (choice) { return __awaiter(void 0, void 0, void
|
|
|
127
50
|
if (!config) {
|
|
128
51
|
return [2 /*return*/];
|
|
129
52
|
}
|
|
130
|
-
return [4 /*yield*/,
|
|
53
|
+
return [4 /*yield*/, (0, printVariables_1.printVariables)(config, choice)];
|
|
131
54
|
case 2:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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();
|
|
139
62
|
return [2 /*return*/];
|
|
140
63
|
}
|
|
141
64
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catenv.js","sourceRoot":"","sources":["../../../src/apps/catenv/catenv.ts"],"names":[],"mappings":"
|
|
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"}
|