Skip to content

Commit 07522d2

Browse files
committed
Merge branch 'main' into TRPCUntypedClient
2 parents 6b0a1b1 + d7b6478 commit 07522d2

7 files changed

Lines changed: 56 additions & 74 deletions

File tree

deno.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@deno/sandbox": "jsr:@deno/sandbox@^0.10.0",
2121
"@std/assert": "jsr:@std/assert@^1.0.16",
2222
"@std/async": "jsr:@std/async@^1.1.0",
23-
"@std/cli": "jsr:@std/cli@1.0.26",
23+
"@std/cli": "jsr:@std/cli@1.0.27",
2424
"@std/dotenv": "jsr:@std/dotenv@^0.225.5",
2525
"@std/encoding": "jsr:@std/encoding@^1.0.10",
2626
"@std/fmt": "jsr:@std/fmt@^1.0.8",
@@ -38,7 +38,6 @@
3838
"superjson": "npm:superjson@^2.2.2",
3939
"@deno/framework-detect": "jsr:@deno/framework-detect@^0",
4040
"temporal-polyfill": "npm:temporal-polyfill@^0.3.0",
41-
"prompts": "npm:prompts@2.4.2",
4241
"pg-connection-string": "npm:pg-connection-string@^2.9.1",
4342
"dax": "jsr:@david/dax@^0.44.2"
4443
},

deno.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const databasesProvisionCommand = new Command<DatabaseContext>()
1616
value: (value: string): "denokv" | "prisma" => {
1717
if (value !== "denokv" && value !== "prisma") {
1818
throw new ValidationError(
19-
`kind must be either "kv" or "prisma", but got "${value}".`,
19+
`kind must be either "denokv" or "prisma", but got "${value}".`,
2020
);
2121
}
2222
return value;

deploy/mod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ deploy your local directory to the specified application.`)
264264
rootPath,
265265
org,
266266
app,
267-
created,
267+
options.prod ?? created,
268268
options.allowNodeModules ?? false,
269269
options.wait ?? true,
270270
);

deploy/setup-cloud.ts

Lines changed: 36 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// @ts-types="@types/prompts"
2-
import prompt from "prompts";
1+
import { promptMultipleSelect } from "@std/cli/unstable-prompt-multiple-select";
32

43
import { gray, green, yellow } from "@std/fmt/colors";
54
import { createTrpcClient } from "../auth.ts";
@@ -181,34 +180,30 @@ export async function setupAws(
181180
log("\r");
182181

183182
const choices = allPolicies.Policies.map((policy) => ({
184-
title: policy.PolicyName,
183+
label: policy.PolicyName,
185184
value: policy.Arn,
186185
}));
187186

188187
let policies;
189188
while (true) {
190-
const result = await prompt({
191-
type: "autocompleteMultiselect",
192-
name: "policies",
193-
message: "Select permission policies you want to attach to the new role",
189+
const result = promptMultipleSelect(
190+
"Select permission policies you want to attach to the new role",
194191
choices,
195-
hint: "- Space to select a policy, Enter to confirm your selections",
196-
instructions: false,
197-
});
192+
{
193+
clear: true,
194+
fitToRemainingHeight: true,
195+
},
196+
);
198197

199-
if (result.policies === undefined) {
198+
if (result === null) {
200199
console.log("%c Exiting setup.", "color: yellow;");
201200
Deno.exit(1);
202201
}
203202

204-
if (result.policies.length === 0) {
205-
const { confirmNoPolicies } = await prompt({
206-
type: "confirm",
207-
name: "confirmNoPolicies",
208-
message:
209-
"Are you sure you don't want to associate any policies? Remember to use Space to select a policy, and Enter to confirm your selections.",
210-
initial: false,
211-
});
203+
if (result.length === 0) {
204+
const confirmNoPolicies = confirm(
205+
"Are you sure you don't want to associate any policies? Remember to use Space to select a policy, and Enter to confirm your selections.",
206+
);
212207
if (!confirmNoPolicies) {
213208
continue;
214209
}
@@ -218,7 +213,7 @@ export async function setupAws(
218213
);
219214
}
220215

221-
policies = result.policies;
216+
policies = result;
222217
break;
223218
}
224219

@@ -290,13 +285,7 @@ export async function setupAws(
290285

291286
console.log("");
292287

293-
const { confirm } = await prompt({
294-
type: "confirm",
295-
name: "confirm",
296-
message: "Do you want to apply these changes?",
297-
initial: true,
298-
});
299-
if (!confirm) {
288+
if (!confirm("Do you want to apply these changes?")) {
300289
console.log("%c Exiting setup.", "color: yellow;");
301290
Deno.exit(1);
302291
}
@@ -390,7 +379,7 @@ export async function setupAws(
390379
"--role-name",
391380
roleName,
392381
"--policy-arn",
393-
policy,
382+
policy.value,
394383
]);
395384
}
396385
console.log(
@@ -510,12 +499,7 @@ export async function setupGcp(
510499
}
511500
console.log("");
512501

513-
const { enableApis } = await prompt({
514-
type: "confirm",
515-
name: "enableApis",
516-
message: "Do you want to enable these APIs now?",
517-
initial: true,
518-
});
502+
const enableApis = confirm("Do you want to enable these APIs now?");
519503

520504
if (!enableApis) {
521505
console.log(
@@ -592,34 +576,30 @@ export async function setupGcp(
592576
log("\r");
593577

594578
const roleChoices = roles.map((role) => ({
595-
title: `${role.title} (${role.name.split("/").pop()})`,
579+
label: `${role.title} (${role.name.split("/").pop()})`,
596580
value: role.name,
597581
}));
598582

599583
let selectedRoles;
600584
while (true) {
601-
const result = await prompt({
602-
type: "autocompleteMultiselect",
603-
name: "selectedRoles",
604-
message: "Select IAM roles you want to grant to the service account",
605-
choices: roleChoices,
606-
hint: "- Space to select a role, Enter to confirm your selections",
607-
instructions: false,
608-
});
609-
610-
if (result.selectedRoles === undefined) {
585+
const result = promptMultipleSelect(
586+
"Select IAM roles you want to grant to the service account",
587+
roleChoices,
588+
{
589+
clear: true,
590+
fitToRemainingHeight: true,
591+
},
592+
);
593+
594+
if (result === null) {
611595
console.log("%c Exiting setup.", "color: yellow;");
612596
Deno.exit(1);
613597
}
614598

615-
if (result.selectedRoles.length === 0) {
616-
const { confirmNoRoles } = await prompt({
617-
type: "confirm",
618-
name: "confirmNoRoles",
619-
message:
620-
"Are you sure you don't want to associate any roles? Remember to use Space to select a role, and Enter to confirm your selections.",
621-
initial: false,
622-
});
599+
if (result.length === 0) {
600+
const confirmNoRoles = confirm(
601+
"Are you sure you don't want to associate any roles? Remember to use Space to select a role, and Enter to confirm your selections.",
602+
);
623603
if (!confirmNoRoles) {
624604
continue;
625605
}
@@ -629,7 +609,7 @@ export async function setupGcp(
629609
);
630610
}
631611

632-
selectedRoles = result.selectedRoles;
612+
selectedRoles = result;
633613
break;
634614
}
635615

@@ -704,7 +684,7 @@ export async function setupGcp(
704684
);
705685

706686
for (const role of selectedRoles) {
707-
const roleName = role.split("/").pop();
687+
const roleName = role.value.split("/").pop();
708688
console.log(
709689
` %c+ grant%c role %c${roleName}%c to the service account`,
710690
"color: green;",
@@ -716,14 +696,7 @@ export async function setupGcp(
716696

717697
console.log("");
718698

719-
const { confirm } = await prompt({
720-
type: "confirm",
721-
name: "confirm",
722-
message: "Do you want to apply these changes?",
723-
initial: true,
724-
});
725-
726-
if (!confirm) {
699+
if (!confirm("Do you want to apply these changes?")) {
727700
console.log("%c Exiting setup.", "color: yellow;");
728701
Deno.exit(1);
729702
}

sandbox/mod.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ export const sandboxCreateCommand = new Command<SandboxContext>()
6161
const name = value.slice(0, separatorIndex);
6262
const path = value.slice(separatorIndex + 1);
6363

64+
if (path === "/") {
65+
throw new ValidationError(
66+
"Volume mount path cannot be /, use --root instead",
67+
);
68+
}
69+
6470
previous[path] = name;
6571

6672
return previous;

util.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ export async function create(
6363
exchangeToken = res.exchangeToken;
6464
}
6565

66+
console.log(`Visit ${url.href} to create a new application.`);
6667
const spinner = new Spinner({
67-
message: `Visit ${url.href} to create a new application.`,
68+
message: "",
6869
color: "yellow",
6970
});
7071
spinner.start();
@@ -108,6 +109,9 @@ export async function create(
108109
]);
109110

110111
spinner.stop();
112+
// clear the previous line, which contains the URL
113+
Deno.stdout.writeSync(new TextEncoder().encode("\x1b[1A\x1b[2K"));
114+
111115
console.log(
112116
`${green("✔")} App '${app}' created in the '${org}' organization.\n`,
113117
);

0 commit comments

Comments
 (0)