@catladder/cli 3.38.0 → 3.39.0

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/package.json CHANGED
@@ -53,7 +53,7 @@
53
53
  }
54
54
  ],
55
55
  "license": "MIT",
56
- "version": "3.38.0",
56
+ "version": "3.39.0",
57
57
  "scripts": {
58
58
  "lint": "eslint \"src/**/*.ts\"",
59
59
  "lint:fix": "eslint \"src/**/*.ts\" --fix",
@@ -33,15 +33,26 @@ export default async (vorpal: Vorpal) =>
33
33
  const allContexts = await getAllPipelineContexts(undefined, {
34
34
  includeLocal: true,
35
35
  });
36
- const envs = allContexts
37
- .filter(hasCloudSql)
36
+ const filteredContexts = allContexts.filter(hasCloudSql);
37
+ const sortByEnv = (a: string, b: string) => {
38
+ const aLocal = a.startsWith("local:");
39
+ const bLocal = b.startsWith("local:");
40
+ if (aLocal !== bLocal) return aLocal ? 1 : -1;
41
+ return a.localeCompare(b);
42
+ };
43
+ const envs = filteredContexts
38
44
  .map((c) => `${c.env}:${c.name}`)
39
- .sort((a, b) => {
40
- const aLocal = a.startsWith("local:");
41
- const bLocal = b.startsWith("local:");
42
- if (aLocal !== bLocal) return aLocal ? 1 : -1;
43
- return a.localeCompare(b);
44
- });
45
+ .sort(sortByEnv);
46
+ const targetEnvChoices = filteredContexts
47
+ .map((c) => {
48
+ const value = `${c.env}:${c.name}`;
49
+ const isProd = c.environment.envType === "prod";
50
+ return {
51
+ name: isProd ? `⚠️ ${value}` : value,
52
+ value,
53
+ };
54
+ })
55
+ .sort((a, b) => sortByEnv(a.value, b.value));
45
56
 
46
57
  const { sourceEnvAndComponent } = await this.prompt({
47
58
  type: "list",
@@ -107,7 +118,7 @@ export default async (vorpal: Vorpal) =>
107
118
  const { targetEnvAndComponent } = await this.prompt({
108
119
  type: "list",
109
120
  name: "targetEnvAndComponent",
110
- choices: envs,
121
+ choices: targetEnvChoices,
111
122
 
112
123
  message: "target env? 🤔 ",
113
124
  });