@prisma/cli 3.0.0-alpha.9 → 3.0.0-dev.30.1.shadd35c2356731
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/README.md +4 -4
- package/dist/adapters/token-storage.js +57 -1
- package/dist/commands/app/index.js +113 -30
- package/dist/commands/env.js +17 -9
- package/dist/controllers/app-env.js +150 -24
- package/dist/controllers/app.js +427 -149
- package/dist/lib/app/domain-guidance.js +14 -0
- package/dist/lib/app/env-config.js +16 -6
- package/dist/lib/app/preview-build.js +50 -5
- package/dist/lib/app/preview-progress.js +1 -25
- package/dist/lib/app/preview-provider.js +99 -1
- package/dist/presenters/app-env.js +4 -3
- package/dist/presenters/app.js +172 -73
- package/dist/shell/command-meta.js +84 -21
- package/dist/shell/command-runner.js +18 -10
- package/dist/shell/errors.js +2 -1
- package/package.json +4 -4
|
@@ -188,44 +188,93 @@ const DESCRIPTORS = [
|
|
|
188
188
|
]
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
|
-
id: "app.
|
|
191
|
+
id: "app.show",
|
|
192
192
|
path: [
|
|
193
193
|
"prisma",
|
|
194
194
|
"app",
|
|
195
|
-
"
|
|
195
|
+
"show"
|
|
196
196
|
],
|
|
197
|
-
description: "
|
|
198
|
-
examples: ["prisma-cli app
|
|
197
|
+
description: "Show the app and its current deployment",
|
|
198
|
+
examples: ["prisma-cli app show", "prisma-cli app show --app hello-world"]
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
|
-
id: "app.
|
|
201
|
+
id: "app.open",
|
|
202
202
|
path: [
|
|
203
203
|
"prisma",
|
|
204
204
|
"app",
|
|
205
|
-
"
|
|
205
|
+
"open"
|
|
206
206
|
],
|
|
207
|
-
description: "
|
|
208
|
-
examples: ["prisma-cli app
|
|
207
|
+
description: "Open the app's live URL",
|
|
208
|
+
examples: ["prisma-cli app open", "prisma-cli app open --app hello-world"]
|
|
209
209
|
},
|
|
210
210
|
{
|
|
211
|
-
id: "app.
|
|
211
|
+
id: "app.domain",
|
|
212
|
+
path: [
|
|
213
|
+
"prisma",
|
|
214
|
+
"app",
|
|
215
|
+
"domain"
|
|
216
|
+
],
|
|
217
|
+
description: "Manage custom domains for an app",
|
|
218
|
+
examples: [
|
|
219
|
+
"prisma-cli app domain add shop.acme.com",
|
|
220
|
+
"prisma-cli app domain wait shop.acme.com --timeout 15m",
|
|
221
|
+
"prisma-cli app domain retry shop.acme.com"
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
id: "app.domain.add",
|
|
212
226
|
path: [
|
|
213
227
|
"prisma",
|
|
214
228
|
"app",
|
|
229
|
+
"domain",
|
|
230
|
+
"add"
|
|
231
|
+
],
|
|
232
|
+
description: "Register a custom domain on the app's production branch",
|
|
233
|
+
examples: ["prisma-cli app domain add shop.acme.com"]
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
id: "app.domain.show",
|
|
237
|
+
path: [
|
|
238
|
+
"prisma",
|
|
239
|
+
"app",
|
|
240
|
+
"domain",
|
|
215
241
|
"show"
|
|
216
242
|
],
|
|
217
|
-
description: "Show
|
|
218
|
-
examples: ["prisma-cli app
|
|
243
|
+
description: "Show custom domain status and certificate details",
|
|
244
|
+
examples: ["prisma-cli app domain show shop.acme.com"]
|
|
219
245
|
},
|
|
220
246
|
{
|
|
221
|
-
id: "app.
|
|
247
|
+
id: "app.domain.remove",
|
|
222
248
|
path: [
|
|
223
249
|
"prisma",
|
|
224
250
|
"app",
|
|
225
|
-
"
|
|
251
|
+
"domain",
|
|
252
|
+
"remove"
|
|
226
253
|
],
|
|
227
|
-
description: "
|
|
228
|
-
examples: ["prisma-cli app
|
|
254
|
+
description: "Detach a custom domain from the app",
|
|
255
|
+
examples: ["prisma-cli app domain remove shop.acme.com --yes"]
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
id: "app.domain.retry",
|
|
259
|
+
path: [
|
|
260
|
+
"prisma",
|
|
261
|
+
"app",
|
|
262
|
+
"domain",
|
|
263
|
+
"retry"
|
|
264
|
+
],
|
|
265
|
+
description: "Retry custom domain DNS verification and TLS provisioning",
|
|
266
|
+
examples: ["prisma-cli app domain retry shop.acme.com"]
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
id: "app.domain.wait",
|
|
270
|
+
path: [
|
|
271
|
+
"prisma",
|
|
272
|
+
"app",
|
|
273
|
+
"domain",
|
|
274
|
+
"wait"
|
|
275
|
+
],
|
|
276
|
+
description: "Wait until a custom domain is active or failed",
|
|
277
|
+
examples: ["prisma-cli app domain wait shop.acme.com", "prisma-cli app domain wait shop.acme.com --timeout 0 --json"]
|
|
229
278
|
},
|
|
230
279
|
{
|
|
231
280
|
id: "app.logs",
|
|
@@ -298,7 +347,8 @@ const DESCRIPTORS = [
|
|
|
298
347
|
examples: [
|
|
299
348
|
"prisma-cli project env list --role production",
|
|
300
349
|
"prisma-cli project env add STRIPE_KEY=sk_test_xxx --role production",
|
|
301
|
-
"prisma-cli project env
|
|
350
|
+
"prisma-cli project env add DATABASE_URL=postgresql://branch --branch feature/foo",
|
|
351
|
+
"prisma-cli project env remove STRIPE_KEY --role preview"
|
|
302
352
|
]
|
|
303
353
|
},
|
|
304
354
|
{
|
|
@@ -313,6 +363,7 @@ const DESCRIPTORS = [
|
|
|
313
363
|
examples: [
|
|
314
364
|
"prisma-cli project env add STRIPE_KEY=sk_test_xxx --role production",
|
|
315
365
|
"prisma-cli project env add STRIPE_KEY=sk_test_xxx --role preview",
|
|
366
|
+
"prisma-cli project env add DATABASE_URL=postgresql://branch --branch feature/foo",
|
|
316
367
|
"API_URL=https://api.example prisma-cli project env add API_URL --project proj_123 --role preview"
|
|
317
368
|
]
|
|
318
369
|
},
|
|
@@ -325,7 +376,11 @@ const DESCRIPTORS = [
|
|
|
325
376
|
"update"
|
|
326
377
|
],
|
|
327
378
|
description: "Replace an existing environment variable's value.",
|
|
328
|
-
examples: [
|
|
379
|
+
examples: [
|
|
380
|
+
"prisma-cli project env update STRIPE_KEY=sk_new_xxx --role production",
|
|
381
|
+
"prisma-cli project env update STRIPE_KEY=sk_new_xxx --role preview",
|
|
382
|
+
"prisma-cli project env update DATABASE_URL=postgresql://branch --branch feature/foo"
|
|
383
|
+
]
|
|
329
384
|
},
|
|
330
385
|
{
|
|
331
386
|
id: "project.env.list",
|
|
@@ -336,18 +391,26 @@ const DESCRIPTORS = [
|
|
|
336
391
|
"list"
|
|
337
392
|
],
|
|
338
393
|
description: "List environment variable metadata for a scope (no values).",
|
|
339
|
-
examples: [
|
|
394
|
+
examples: [
|
|
395
|
+
"prisma-cli project env list --role production",
|
|
396
|
+
"prisma-cli project env list --role preview",
|
|
397
|
+
"prisma-cli project env list --branch feature/foo"
|
|
398
|
+
]
|
|
340
399
|
},
|
|
341
400
|
{
|
|
342
|
-
id: "project.env.
|
|
401
|
+
id: "project.env.remove",
|
|
343
402
|
path: [
|
|
344
403
|
"prisma",
|
|
345
404
|
"project",
|
|
346
405
|
"env",
|
|
347
|
-
"
|
|
406
|
+
"remove"
|
|
348
407
|
],
|
|
349
408
|
description: "Remove an environment variable from a scope.",
|
|
350
|
-
examples: [
|
|
409
|
+
examples: [
|
|
410
|
+
"prisma-cli project env remove STRIPE_KEY --role production",
|
|
411
|
+
"prisma-cli project env remove STRIPE_KEY --role preview",
|
|
412
|
+
"prisma-cli project env remove DATABASE_URL --branch feature/foo"
|
|
413
|
+
]
|
|
351
414
|
}
|
|
352
415
|
];
|
|
353
416
|
const DESCRIPTORS_BY_ID = new Map(DESCRIPTORS.map((descriptor) => [descriptor.id, descriptor]));
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { CliError } from "./errors.js";
|
|
1
|
+
import { CliError, authRequiredError } from "./errors.js";
|
|
2
2
|
import { cliErrorToJson, writeHumanError, writeHumanLines, writeJsonError, writeJsonEvent, writeJsonSuccess } from "./output.js";
|
|
3
3
|
import { getCommandDescriptor } from "./command-meta.js";
|
|
4
4
|
import { resolveGlobalFlags } from "./global-flags.js";
|
|
5
5
|
import { createCommandContext } from "./runtime.js";
|
|
6
|
+
import { AuthError } from "@prisma/management-api-sdk";
|
|
6
7
|
//#region src/shell/command-runner.ts
|
|
8
|
+
function toCliError(error) {
|
|
9
|
+
if (error instanceof CliError) return error;
|
|
10
|
+
if (error instanceof AuthError) return authRequiredError(["prisma-cli auth login"], { debug: error.message });
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
7
13
|
async function runCommand(runtime, commandName, options, handler, presenter) {
|
|
8
14
|
const flags = resolveGlobalFlags(runtime.argv, options);
|
|
9
15
|
const context = await createCommandContext(runtime, flags);
|
|
@@ -20,10 +26,11 @@ async function runCommand(runtime, commandName, options, handler, presenter) {
|
|
|
20
26
|
if (flags.quiet) return;
|
|
21
27
|
writeHumanLines(context.output, presenter.renderHuman(context, descriptor, success.result));
|
|
22
28
|
} catch (error) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
const cliError = toCliError(error);
|
|
30
|
+
if (cliError) {
|
|
31
|
+
if (flags.json) writeJsonError(context.output, commandName, cliError);
|
|
32
|
+
else writeHumanError(context.output, context.ui, cliError, { trace: flags.trace });
|
|
33
|
+
process.exitCode = cliError.exitCode;
|
|
27
34
|
return;
|
|
28
35
|
}
|
|
29
36
|
throw error;
|
|
@@ -43,17 +50,18 @@ async function runStreamingCommand(runtime, commandName, options, handler) {
|
|
|
43
50
|
nextSteps: []
|
|
44
51
|
});
|
|
45
52
|
} catch (error) {
|
|
46
|
-
|
|
53
|
+
const cliError = toCliError(error);
|
|
54
|
+
if (cliError) {
|
|
47
55
|
if (flags.json) writeJsonEvent(context.output, {
|
|
48
56
|
type: "error",
|
|
49
57
|
command: commandName,
|
|
50
58
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
51
|
-
error: cliErrorToJson(
|
|
59
|
+
error: cliErrorToJson(cliError),
|
|
52
60
|
warnings: [],
|
|
53
|
-
nextSteps:
|
|
61
|
+
nextSteps: cliError.nextSteps
|
|
54
62
|
});
|
|
55
|
-
else writeHumanError(context.output, context.ui,
|
|
56
|
-
process.exitCode =
|
|
63
|
+
else writeHumanError(context.output, context.ui, cliError, { trace: flags.trace });
|
|
64
|
+
process.exitCode = cliError.exitCode;
|
|
57
65
|
return;
|
|
58
66
|
}
|
|
59
67
|
throw error;
|
package/dist/shell/errors.js
CHANGED
|
@@ -42,13 +42,14 @@ function usageError(summary, why, fix, nextSteps = [], domain = "cli") {
|
|
|
42
42
|
nextSteps
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
function authRequiredError(nextSteps = ["prisma-cli auth login"]) {
|
|
45
|
+
function authRequiredError(nextSteps = ["prisma-cli auth login"], options = {}) {
|
|
46
46
|
return new CliError({
|
|
47
47
|
code: "AUTH_REQUIRED",
|
|
48
48
|
domain: "auth",
|
|
49
49
|
summary: "Authentication required",
|
|
50
50
|
why: "This command needs an authenticated session.",
|
|
51
51
|
fix: "Run prisma-cli auth login, or rerun the command in a TTY to sign in interactively.",
|
|
52
|
+
debug: options.debug,
|
|
52
53
|
exitCode: 1,
|
|
53
54
|
nextSteps
|
|
54
55
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/cli",
|
|
3
|
-
"version": "3.0.0-
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.0.0-dev.30.1.shadd35c2356731",
|
|
4
|
+
"description": "Beta of the unified Prisma CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"prisma-cli": "./dist/cli.js"
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@clack/prompts": "^1.2.0",
|
|
39
|
-
"@prisma/compute-sdk": "^0.
|
|
39
|
+
"@prisma/compute-sdk": "^0.19.0",
|
|
40
40
|
"c12": "4.0.0-beta.4",
|
|
41
41
|
"@prisma/credentials-store": "^7.7.0",
|
|
42
|
-
"@prisma/management-api-sdk": "^1.
|
|
42
|
+
"@prisma/management-api-sdk": "^1.33.1",
|
|
43
43
|
"colorette": "^2.0.20",
|
|
44
44
|
"commander": "^12.1.0",
|
|
45
45
|
"magicast": "^0.3.5",
|