@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/dist/bundles/cli/index.js +1 -1
- package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js +17 -6
- package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +20 -9
package/package.json
CHANGED
|
@@ -33,15 +33,26 @@ export default async (vorpal: Vorpal) =>
|
|
|
33
33
|
const allContexts = await getAllPipelineContexts(undefined, {
|
|
34
34
|
includeLocal: true,
|
|
35
35
|
});
|
|
36
|
-
const
|
|
37
|
-
|
|
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(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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:
|
|
121
|
+
choices: targetEnvChoices,
|
|
111
122
|
|
|
112
123
|
message: "target env? 🤔 ",
|
|
113
124
|
});
|