@prisma/cli 3.0.0-alpha.0 → 3.0.0-alpha.10
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 +1 -16
- package/dist/adapters/git.js +49 -0
- package/dist/adapters/local-state.js +39 -1
- package/dist/cli2.js +60 -4
- package/dist/commands/app/index.js +43 -30
- package/dist/commands/auth/index.js +3 -2
- package/dist/commands/branch/index.js +2 -1
- package/dist/commands/env.js +87 -0
- package/dist/commands/git/index.js +36 -0
- package/dist/commands/project/index.js +12 -14
- package/dist/commands/version/index.js +18 -0
- package/dist/controllers/app-env.js +223 -0
- package/dist/controllers/app.js +1051 -173
- package/dist/controllers/auth.js +9 -9
- package/dist/controllers/branch.js +6 -6
- package/dist/controllers/project.js +451 -161
- package/dist/controllers/version.js +12 -0
- package/dist/lib/app/bun-project.js +1 -1
- package/dist/lib/app/deploy-output.js +15 -0
- package/dist/lib/app/env-config.js +57 -0
- package/dist/lib/app/env-vars.js +4 -4
- package/dist/lib/app/local-dev.js +2 -1
- package/dist/lib/app/preview-build.js +130 -144
- package/dist/lib/app/preview-interaction.js +2 -35
- package/dist/lib/app/preview-progress.js +43 -58
- package/dist/lib/app/preview-provider.js +125 -24
- package/dist/lib/auth/auth-ops.js +58 -13
- package/dist/lib/auth/client.js +1 -1
- package/dist/lib/auth/guard.js +1 -1
- package/dist/lib/auth/login.js +115 -4
- package/dist/lib/project/local-pin.js +51 -0
- package/dist/lib/project/resolution.js +201 -0
- package/dist/lib/version.js +55 -0
- package/dist/output/patterns.js +15 -18
- package/dist/presenters/app-env.js +129 -0
- package/dist/presenters/app.js +16 -29
- package/dist/presenters/auth.js +2 -2
- package/dist/presenters/branch.js +6 -6
- package/dist/presenters/project.js +87 -44
- package/dist/presenters/version.js +29 -0
- package/dist/shell/command-meta.js +150 -84
- package/dist/shell/command-runner.js +32 -2
- package/dist/shell/errors.js +8 -3
- package/dist/shell/global-flags.js +13 -1
- package/dist/shell/help.js +8 -7
- package/dist/shell/output.js +29 -12
- package/dist/shell/prompt.js +12 -2
- package/dist/shell/runtime.js +1 -1
- package/dist/shell/ui.js +19 -1
- package/dist/use-cases/auth.js +9 -12
- package/dist/use-cases/branch.js +20 -20
- package/dist/use-cases/create-cli-gateways.js +3 -13
- package/dist/use-cases/project.js +2 -48
- package/package.json +3 -3
- package/dist/adapters/config.js +0 -74
|
@@ -12,7 +12,7 @@ function renderProjectList(context, descriptor, result) {
|
|
|
12
12
|
noun: "project",
|
|
13
13
|
label: project.name,
|
|
14
14
|
id: project.id,
|
|
15
|
-
status:
|
|
15
|
+
status: null
|
|
16
16
|
})),
|
|
17
17
|
emptyMessage: "No projects found."
|
|
18
18
|
}, context.ui);
|
|
@@ -24,61 +24,104 @@ function serializeProjectList(result) {
|
|
|
24
24
|
noun: "project",
|
|
25
25
|
label: project.name,
|
|
26
26
|
id: project.id,
|
|
27
|
-
status:
|
|
27
|
+
status: null
|
|
28
28
|
}))
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
function renderProjectShow(context, descriptor, result) {
|
|
32
|
-
|
|
33
|
-
title: "Showing the
|
|
34
|
-
descriptor,
|
|
35
|
-
fields: [{
|
|
36
|
-
key: "project",
|
|
37
|
-
value: "not linked",
|
|
38
|
-
tone: "dim"
|
|
39
|
-
}]
|
|
40
|
-
}, context.ui);
|
|
41
|
-
if (!result.project || !result.workspace) return renderShow({
|
|
42
|
-
title: "Showing the linked project for the current repo.",
|
|
32
|
+
return renderShow({
|
|
33
|
+
title: "Showing the project Prisma resolves for this directory.",
|
|
43
34
|
descriptor,
|
|
44
|
-
fields: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
35
|
+
fields: [
|
|
36
|
+
{
|
|
37
|
+
key: "workspace",
|
|
38
|
+
value: result.workspace.name
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
key: "project",
|
|
42
|
+
value: result.project.name
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
key: "resolution",
|
|
46
|
+
value: formatProjectSource(result.resolution.projectSource)
|
|
47
|
+
}
|
|
48
|
+
]
|
|
53
49
|
}, context.ui);
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
}
|
|
51
|
+
function serializeProjectShow(result) {
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
function renderGitConnect(context, descriptor, result) {
|
|
55
|
+
const connection = result.repositoryConnection;
|
|
56
|
+
return renderMutate({
|
|
57
|
+
title: "Connecting Git to the resolved project.",
|
|
56
58
|
descriptor,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
context: [
|
|
60
|
+
{
|
|
61
|
+
key: "project",
|
|
62
|
+
value: result.project.name
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
key: "workspace",
|
|
66
|
+
value: result.workspace.name
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
key: "repository",
|
|
70
|
+
value: connection.repository.fullName
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
key: "status",
|
|
74
|
+
value: connection.status
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
operationDescription: "Applying repository connection",
|
|
78
|
+
operationCount: 1,
|
|
79
|
+
details: [formatGitConnectionDetail(connection.status)]
|
|
64
80
|
}, context.ui);
|
|
65
81
|
}
|
|
66
|
-
function
|
|
67
|
-
if (!result.project || !result.workspace) throw new Error("Linked project result must be enriched for human output.");
|
|
82
|
+
function renderGitDisconnect(context, descriptor, result) {
|
|
68
83
|
return renderMutate({
|
|
69
|
-
title: "
|
|
84
|
+
title: "Disconnecting Git from the resolved project.",
|
|
70
85
|
descriptor,
|
|
71
|
-
context: [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
86
|
+
context: [
|
|
87
|
+
{
|
|
88
|
+
key: "project",
|
|
89
|
+
value: result.project.name
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
key: "workspace",
|
|
93
|
+
value: result.workspace.name
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
key: "repository",
|
|
97
|
+
value: result.repositoryConnection.repository.fullName
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
operationDescription: "Applying repository disconnection",
|
|
79
101
|
operationCount: 1,
|
|
80
|
-
details: ["
|
|
102
|
+
details: ["GitHub branch automation is no longer active for this project."]
|
|
81
103
|
}, context.ui);
|
|
82
104
|
}
|
|
105
|
+
function formatProjectSource(source) {
|
|
106
|
+
switch (source) {
|
|
107
|
+
case "explicit": return "explicit";
|
|
108
|
+
case "env": return "environment";
|
|
109
|
+
case "local-pin": return "local pin";
|
|
110
|
+
case "platform-mapping": return "platform mapping";
|
|
111
|
+
case "remembered-local": return "remembered local context";
|
|
112
|
+
case "package-name": return "package name";
|
|
113
|
+
case "directory-name": return "directory name";
|
|
114
|
+
case "created": return "created";
|
|
115
|
+
case "prompt": return "prompt";
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function formatGitConnectionDetail(status) {
|
|
119
|
+
switch (status) {
|
|
120
|
+
case "active": return "GitHub branch automation is active for this project.";
|
|
121
|
+
case "pending": return "GitHub branch automation is pending GitHub App installation.";
|
|
122
|
+
case "archived": return "GitHub branch automation has been archived for this project.";
|
|
123
|
+
default: return "GitHub repository is connected, but branch automation is not active.";
|
|
124
|
+
}
|
|
125
|
+
}
|
|
83
126
|
//#endregion
|
|
84
|
-
export {
|
|
127
|
+
export { renderGitConnect, renderGitDisconnect, renderProjectList, renderProjectShow, serializeProjectList, serializeProjectShow };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { renderShow } from "../output/patterns.js";
|
|
2
|
+
//#region src/presenters/version.ts
|
|
3
|
+
function renderVersionSuccess(context, descriptor, result) {
|
|
4
|
+
return renderShow({
|
|
5
|
+
title: "Showing CLI build and environment.",
|
|
6
|
+
descriptor,
|
|
7
|
+
fields: [
|
|
8
|
+
{
|
|
9
|
+
key: result.cli.name,
|
|
10
|
+
value: result.cli.version
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
key: "node",
|
|
14
|
+
value: result.node.version
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: "os",
|
|
18
|
+
value: `${result.os.platform} ${result.os.arch}`
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
key: "invocation",
|
|
22
|
+
value: result.invocation,
|
|
23
|
+
tone: result.invocation === "unknown" ? "dim" : "default"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}, context.ui);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { renderVersionSuccess };
|
|
@@ -4,17 +4,21 @@ const DESCRIPTORS = [
|
|
|
4
4
|
{
|
|
5
5
|
id: "root",
|
|
6
6
|
path: ["prisma"],
|
|
7
|
-
description: "
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
description: "The Prisma Developer Platform, from your terminal",
|
|
8
|
+
examples: ["prisma-cli auth login", "prisma-cli app deploy"],
|
|
9
|
+
longDescription: "Deploy your app with isolated infrastructure for every branch"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "version",
|
|
13
|
+
path: ["prisma", "version"],
|
|
14
|
+
description: "Show CLI build and environment",
|
|
15
|
+
examples: ["prisma-cli version", "prisma-cli version --json"]
|
|
11
16
|
},
|
|
12
17
|
{
|
|
13
18
|
id: "auth",
|
|
14
19
|
path: ["prisma", "auth"],
|
|
15
|
-
description: "
|
|
16
|
-
|
|
17
|
-
examples: ["prisma auth login", "prisma auth whoami"]
|
|
20
|
+
description: "Manage local authentication for the CLI",
|
|
21
|
+
examples: ["prisma-cli auth login", "prisma-cli auth whoami"]
|
|
18
22
|
},
|
|
19
23
|
{
|
|
20
24
|
id: "auth.login",
|
|
@@ -23,9 +27,8 @@ const DESCRIPTORS = [
|
|
|
23
27
|
"auth",
|
|
24
28
|
"login"
|
|
25
29
|
],
|
|
26
|
-
description: "
|
|
27
|
-
|
|
28
|
-
examples: ["prisma auth login"]
|
|
30
|
+
description: "Log in to your Prisma platform account",
|
|
31
|
+
examples: ["prisma-cli auth login"]
|
|
29
32
|
},
|
|
30
33
|
{
|
|
31
34
|
id: "auth.logout",
|
|
@@ -34,9 +37,8 @@ const DESCRIPTORS = [
|
|
|
34
37
|
"auth",
|
|
35
38
|
"logout"
|
|
36
39
|
],
|
|
37
|
-
description: "Clear
|
|
38
|
-
|
|
39
|
-
examples: ["prisma auth logout"]
|
|
40
|
+
description: "Clear stored authentication credentials",
|
|
41
|
+
examples: ["prisma-cli auth logout"]
|
|
40
42
|
},
|
|
41
43
|
{
|
|
42
44
|
id: "auth.whoami",
|
|
@@ -45,30 +47,32 @@ const DESCRIPTORS = [
|
|
|
45
47
|
"auth",
|
|
46
48
|
"whoami"
|
|
47
49
|
],
|
|
48
|
-
description: "Show the
|
|
49
|
-
|
|
50
|
-
examples: ["prisma auth whoami", "prisma auth whoami --json"]
|
|
50
|
+
description: "Show the authenticated user and accessible workspace",
|
|
51
|
+
examples: ["prisma-cli auth whoami", "prisma-cli auth whoami --json"]
|
|
51
52
|
},
|
|
52
53
|
{
|
|
53
54
|
id: "project",
|
|
54
55
|
path: ["prisma", "project"],
|
|
55
|
-
description: "
|
|
56
|
-
|
|
57
|
-
examples: ["prisma project list", "prisma project show"]
|
|
56
|
+
description: "Manage and inspect your Prisma projects",
|
|
57
|
+
examples: ["prisma-cli project list", "prisma-cli project show"]
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
id: "app",
|
|
61
61
|
path: ["prisma", "app"],
|
|
62
|
-
description: "
|
|
63
|
-
|
|
64
|
-
examples: ["prisma app build --build-type nextjs", "prisma app deploy --app hello-world --build-type nextjs --http-port 3000"]
|
|
62
|
+
description: "Manage apps and deployments for a project",
|
|
63
|
+
examples: ["prisma-cli app deploy", "prisma-cli app deploy --app my-app --framework nextjs --http-port 3000"]
|
|
65
64
|
},
|
|
66
65
|
{
|
|
67
66
|
id: "branch",
|
|
68
67
|
path: ["prisma", "branch"],
|
|
69
|
-
description: "
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
description: "View your active Platform branches",
|
|
69
|
+
examples: ["prisma-cli branch list", "prisma-cli branch show"]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "git",
|
|
73
|
+
path: ["prisma", "git"],
|
|
74
|
+
description: "Manage Git repository connections for a project",
|
|
75
|
+
examples: ["prisma-cli git connect", "prisma-cli git disconnect"]
|
|
72
76
|
},
|
|
73
77
|
{
|
|
74
78
|
id: "project.list",
|
|
@@ -77,9 +81,8 @@ const DESCRIPTORS = [
|
|
|
77
81
|
"project",
|
|
78
82
|
"list"
|
|
79
83
|
],
|
|
80
|
-
description: "List projects
|
|
81
|
-
|
|
82
|
-
examples: ["prisma project list", "prisma project list --json"]
|
|
84
|
+
description: "List all projects in your workspace",
|
|
85
|
+
examples: ["prisma-cli project list", "prisma-cli project list --json"]
|
|
83
86
|
},
|
|
84
87
|
{
|
|
85
88
|
id: "project.show",
|
|
@@ -88,20 +91,32 @@ const DESCRIPTORS = [
|
|
|
88
91
|
"project",
|
|
89
92
|
"show"
|
|
90
93
|
],
|
|
91
|
-
description: "Show
|
|
92
|
-
|
|
93
|
-
examples: ["prisma project show", "prisma project show --json"]
|
|
94
|
+
description: "Show which project is active for this directory",
|
|
95
|
+
examples: ["prisma-cli project show", "prisma-cli project show --project proj_123 --json"]
|
|
94
96
|
},
|
|
95
97
|
{
|
|
96
|
-
id: "
|
|
98
|
+
id: "git.connect",
|
|
97
99
|
path: [
|
|
98
100
|
"prisma",
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
+
"git",
|
|
102
|
+
"connect"
|
|
101
103
|
],
|
|
102
|
-
description: "
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
description: "Connect the resolved project to a GitHub repository",
|
|
105
|
+
examples: [
|
|
106
|
+
"prisma-cli git connect",
|
|
107
|
+
"prisma-cli git connect git@github.com:prisma/prisma-cli.git",
|
|
108
|
+
"prisma-cli git connect --project proj_123"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "git.disconnect",
|
|
113
|
+
path: [
|
|
114
|
+
"prisma",
|
|
115
|
+
"git",
|
|
116
|
+
"disconnect"
|
|
117
|
+
],
|
|
118
|
+
description: "Disconnect the GitHub repository from the resolved project",
|
|
119
|
+
examples: ["prisma-cli git disconnect", "prisma-cli git disconnect --project proj_123"]
|
|
105
120
|
},
|
|
106
121
|
{
|
|
107
122
|
id: "branch.list",
|
|
@@ -110,9 +125,8 @@ const DESCRIPTORS = [
|
|
|
110
125
|
"branch",
|
|
111
126
|
"list"
|
|
112
127
|
],
|
|
113
|
-
description: "List branches for the
|
|
114
|
-
|
|
115
|
-
examples: ["prisma branch list", "prisma branch list --json"]
|
|
128
|
+
description: "List active Platform branches for the resolved project",
|
|
129
|
+
examples: ["prisma-cli branch list", "prisma-cli branch list --json"]
|
|
116
130
|
},
|
|
117
131
|
{
|
|
118
132
|
id: "branch.show",
|
|
@@ -121,9 +135,8 @@ const DESCRIPTORS = [
|
|
|
121
135
|
"branch",
|
|
122
136
|
"show"
|
|
123
137
|
],
|
|
124
|
-
description: "Show the current
|
|
125
|
-
|
|
126
|
-
examples: ["prisma branch show", "prisma branch show --json"]
|
|
138
|
+
description: "Show the Platform branch matching your current Git branch",
|
|
139
|
+
examples: ["prisma-cli branch show", "prisma-cli branch show --json"]
|
|
127
140
|
},
|
|
128
141
|
{
|
|
129
142
|
id: "branch.use",
|
|
@@ -133,8 +146,7 @@ const DESCRIPTORS = [
|
|
|
133
146
|
"use"
|
|
134
147
|
],
|
|
135
148
|
description: "Change the local default branch context.",
|
|
136
|
-
|
|
137
|
-
examples: ["prisma branch use", "prisma branch use production"]
|
|
149
|
+
examples: ["prisma-cli branch use", "prisma-cli branch use production"]
|
|
138
150
|
},
|
|
139
151
|
{
|
|
140
152
|
id: "app.build",
|
|
@@ -143,9 +155,12 @@ const DESCRIPTORS = [
|
|
|
143
155
|
"app",
|
|
144
156
|
"build"
|
|
145
157
|
],
|
|
146
|
-
description: "Build the
|
|
147
|
-
|
|
148
|
-
|
|
158
|
+
description: "Build the app locally into a deployable artifact",
|
|
159
|
+
examples: [
|
|
160
|
+
"prisma-cli app build --build-type nextjs",
|
|
161
|
+
"prisma-cli app build --build-type nuxt",
|
|
162
|
+
"prisma-cli app build --build-type bun --entry server.ts"
|
|
163
|
+
]
|
|
149
164
|
},
|
|
150
165
|
{
|
|
151
166
|
id: "app.run",
|
|
@@ -154,9 +169,8 @@ const DESCRIPTORS = [
|
|
|
154
169
|
"app",
|
|
155
170
|
"run"
|
|
156
171
|
],
|
|
157
|
-
description: "
|
|
158
|
-
|
|
159
|
-
examples: ["prisma app run --build-type nextjs", "prisma app run --build-type bun --entry server.ts --port 3000"]
|
|
172
|
+
description: "Run your app locally",
|
|
173
|
+
examples: ["prisma-cli app run --build-type nextjs", "prisma-cli app run --build-type bun --entry server.ts --port 3000"]
|
|
160
174
|
},
|
|
161
175
|
{
|
|
162
176
|
id: "app.deploy",
|
|
@@ -165,12 +179,12 @@ const DESCRIPTORS = [
|
|
|
165
179
|
"app",
|
|
166
180
|
"deploy"
|
|
167
181
|
],
|
|
168
|
-
description: "
|
|
169
|
-
docsPath: "docs/product/command-spec.md#prisma-app-deploy---app-name---entry-path---build-type-autobunnextjs---http-port-port---env-namevalue",
|
|
182
|
+
description: "Creates a new deployment for the app",
|
|
170
183
|
examples: [
|
|
171
|
-
"prisma app deploy",
|
|
172
|
-
"prisma app deploy --app
|
|
173
|
-
"prisma app deploy --app
|
|
184
|
+
"prisma-cli app deploy",
|
|
185
|
+
"prisma-cli app deploy --app my-app --env DATABASE_URL=postgresql://example",
|
|
186
|
+
"prisma-cli app deploy --app my-app --framework nextjs --http-port 3000",
|
|
187
|
+
"prisma-cli app deploy --branch feat-login --framework hono"
|
|
174
188
|
]
|
|
175
189
|
},
|
|
176
190
|
{
|
|
@@ -181,8 +195,7 @@ const DESCRIPTORS = [
|
|
|
181
195
|
"update-env"
|
|
182
196
|
],
|
|
183
197
|
description: "Create a new deployment with updated environment variables.",
|
|
184
|
-
|
|
185
|
-
examples: ["prisma app update-env --env DATABASE_URL=postgresql://example", "prisma app update-env --app hello-world --env DATABASE_URL=postgresql://another"]
|
|
198
|
+
examples: ["prisma-cli app update-env --env DATABASE_URL=postgresql://example", "prisma-cli app update-env --app hello-world --env DATABASE_URL=postgresql://another"]
|
|
186
199
|
},
|
|
187
200
|
{
|
|
188
201
|
id: "app.list-env",
|
|
@@ -192,8 +205,7 @@ const DESCRIPTORS = [
|
|
|
192
205
|
"list-env"
|
|
193
206
|
],
|
|
194
207
|
description: "List environment variable names for the selected app.",
|
|
195
|
-
|
|
196
|
-
examples: ["prisma app list-env", "prisma app list-env --app hello-world"]
|
|
208
|
+
examples: ["prisma-cli app list-env", "prisma-cli app list-env --app hello-world"]
|
|
197
209
|
},
|
|
198
210
|
{
|
|
199
211
|
id: "app.show",
|
|
@@ -202,9 +214,8 @@ const DESCRIPTORS = [
|
|
|
202
214
|
"app",
|
|
203
215
|
"show"
|
|
204
216
|
],
|
|
205
|
-
description: "Show the
|
|
206
|
-
|
|
207
|
-
examples: ["prisma app show", "prisma app show --app hello-world"]
|
|
217
|
+
description: "Show the app and its current deployment",
|
|
218
|
+
examples: ["prisma-cli app show", "prisma-cli app show --app hello-world"]
|
|
208
219
|
},
|
|
209
220
|
{
|
|
210
221
|
id: "app.open",
|
|
@@ -213,9 +224,8 @@ const DESCRIPTORS = [
|
|
|
213
224
|
"app",
|
|
214
225
|
"open"
|
|
215
226
|
],
|
|
216
|
-
description: "Open the live URL
|
|
217
|
-
|
|
218
|
-
examples: ["prisma app open", "prisma app open --app hello-world"]
|
|
227
|
+
description: "Open the app's live URL",
|
|
228
|
+
examples: ["prisma-cli app open", "prisma-cli app open --app hello-world"]
|
|
219
229
|
},
|
|
220
230
|
{
|
|
221
231
|
id: "app.logs",
|
|
@@ -224,9 +234,8 @@ const DESCRIPTORS = [
|
|
|
224
234
|
"app",
|
|
225
235
|
"logs"
|
|
226
236
|
],
|
|
227
|
-
description: "
|
|
228
|
-
|
|
229
|
-
examples: ["prisma app logs", "prisma app logs --deployment dep_123"]
|
|
237
|
+
description: "Stream logs for the app's current deployment",
|
|
238
|
+
examples: ["prisma-cli app logs", "prisma-cli app logs --deployment dep_123"]
|
|
230
239
|
},
|
|
231
240
|
{
|
|
232
241
|
id: "app.list-deploys",
|
|
@@ -235,9 +244,8 @@ const DESCRIPTORS = [
|
|
|
235
244
|
"app",
|
|
236
245
|
"list-deploys"
|
|
237
246
|
],
|
|
238
|
-
description: "List deployments for the
|
|
239
|
-
|
|
240
|
-
examples: ["prisma app list-deploys", "prisma app list-deploys --app hello-world"]
|
|
247
|
+
description: "List deployments for the app",
|
|
248
|
+
examples: ["prisma-cli app list-deploys", "prisma-cli app list-deploys --app hello-world"]
|
|
241
249
|
},
|
|
242
250
|
{
|
|
243
251
|
id: "app.show-deploy",
|
|
@@ -246,9 +254,8 @@ const DESCRIPTORS = [
|
|
|
246
254
|
"app",
|
|
247
255
|
"show-deploy"
|
|
248
256
|
],
|
|
249
|
-
description: "Show
|
|
250
|
-
|
|
251
|
-
examples: ["prisma app show-deploy dep_123"]
|
|
257
|
+
description: "Show a deployment in detail",
|
|
258
|
+
examples: ["prisma-cli app show-deploy dep_123"]
|
|
252
259
|
},
|
|
253
260
|
{
|
|
254
261
|
id: "app.promote",
|
|
@@ -257,9 +264,8 @@ const DESCRIPTORS = [
|
|
|
257
264
|
"app",
|
|
258
265
|
"promote"
|
|
259
266
|
],
|
|
260
|
-
description: "
|
|
261
|
-
|
|
262
|
-
examples: ["prisma app promote dep_123", "prisma app promote dep_123 --app hello-world"]
|
|
267
|
+
description: "Promote a deployment to production by rebuilding with production env vars",
|
|
268
|
+
examples: ["prisma-cli app promote dep_123", "prisma-cli app promote dep_123 --app hello-world"]
|
|
263
269
|
},
|
|
264
270
|
{
|
|
265
271
|
id: "app.rollback",
|
|
@@ -268,9 +274,8 @@ const DESCRIPTORS = [
|
|
|
268
274
|
"app",
|
|
269
275
|
"rollback"
|
|
270
276
|
],
|
|
271
|
-
description: "
|
|
272
|
-
|
|
273
|
-
examples: ["prisma app rollback", "prisma app rollback --app hello-world --to dep_123"]
|
|
277
|
+
description: "Roll back production to a previous deployment",
|
|
278
|
+
examples: ["prisma-cli app rollback", "prisma-cli app rollback --app hello-world --to dep_123"]
|
|
274
279
|
},
|
|
275
280
|
{
|
|
276
281
|
id: "app.remove",
|
|
@@ -279,9 +284,70 @@ const DESCRIPTORS = [
|
|
|
279
284
|
"app",
|
|
280
285
|
"remove"
|
|
281
286
|
],
|
|
282
|
-
description: "Remove the
|
|
283
|
-
|
|
284
|
-
|
|
287
|
+
description: "Remove the app from the current branch",
|
|
288
|
+
examples: ["prisma-cli app remove --app hello-world", "prisma-cli app remove --app hello-world --yes"]
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
id: "project.env",
|
|
292
|
+
path: [
|
|
293
|
+
"prisma",
|
|
294
|
+
"project",
|
|
295
|
+
"env"
|
|
296
|
+
],
|
|
297
|
+
description: "Manage environment variables for the active project",
|
|
298
|
+
examples: [
|
|
299
|
+
"prisma-cli project env list --role production",
|
|
300
|
+
"prisma-cli project env add STRIPE_KEY=sk_test_xxx --role production",
|
|
301
|
+
"prisma-cli project env rm STRIPE_KEY --role preview"
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
id: "project.env.add",
|
|
306
|
+
path: [
|
|
307
|
+
"prisma",
|
|
308
|
+
"project",
|
|
309
|
+
"env",
|
|
310
|
+
"add"
|
|
311
|
+
],
|
|
312
|
+
description: "Create a new environment variable.",
|
|
313
|
+
examples: [
|
|
314
|
+
"prisma-cli project env add STRIPE_KEY=sk_test_xxx --role production",
|
|
315
|
+
"prisma-cli project env add STRIPE_KEY=sk_test_xxx --role preview",
|
|
316
|
+
"API_URL=https://api.example prisma-cli project env add API_URL --project proj_123 --role preview"
|
|
317
|
+
]
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
id: "project.env.update",
|
|
321
|
+
path: [
|
|
322
|
+
"prisma",
|
|
323
|
+
"project",
|
|
324
|
+
"env",
|
|
325
|
+
"update"
|
|
326
|
+
],
|
|
327
|
+
description: "Replace an existing environment variable's value.",
|
|
328
|
+
examples: ["prisma-cli project env update STRIPE_KEY=sk_new_xxx --role production", "prisma-cli project env update STRIPE_KEY=sk_new_xxx --role preview"]
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
id: "project.env.list",
|
|
332
|
+
path: [
|
|
333
|
+
"prisma",
|
|
334
|
+
"project",
|
|
335
|
+
"env",
|
|
336
|
+
"list"
|
|
337
|
+
],
|
|
338
|
+
description: "List environment variable metadata for a scope (no values).",
|
|
339
|
+
examples: ["prisma-cli project env list --role production", "prisma-cli project env list --role preview"]
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
id: "project.env.rm",
|
|
343
|
+
path: [
|
|
344
|
+
"prisma",
|
|
345
|
+
"project",
|
|
346
|
+
"env",
|
|
347
|
+
"rm"
|
|
348
|
+
],
|
|
349
|
+
description: "Remove an environment variable from a scope.",
|
|
350
|
+
examples: ["prisma-cli project env rm STRIPE_KEY --role production", "prisma-cli project env rm STRIPE_KEY --role preview"]
|
|
285
351
|
}
|
|
286
352
|
];
|
|
287
353
|
const DESCRIPTORS_BY_ID = new Map(DESCRIPTORS.map((descriptor) => [descriptor.id, descriptor]));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CliError } from "./errors.js";
|
|
2
|
+
import { cliErrorToJson, writeHumanError, writeHumanLines, writeJsonError, writeJsonEvent, writeJsonSuccess } from "./output.js";
|
|
2
3
|
import { getCommandDescriptor } from "./command-meta.js";
|
|
3
4
|
import { resolveGlobalFlags } from "./global-flags.js";
|
|
4
5
|
import { createCommandContext } from "./runtime.js";
|
|
5
|
-
import { writeHumanError, writeHumanLines, writeJsonError, writeJsonSuccess } from "./output.js";
|
|
6
6
|
//#region src/shell/command-runner.ts
|
|
7
7
|
async function runCommand(runtime, commandName, options, handler, presenter) {
|
|
8
8
|
const flags = resolveGlobalFlags(runtime.argv, options);
|
|
@@ -29,5 +29,35 @@ async function runCommand(runtime, commandName, options, handler, presenter) {
|
|
|
29
29
|
throw error;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
+
async function runStreamingCommand(runtime, commandName, options, handler) {
|
|
33
|
+
const flags = resolveGlobalFlags(runtime.argv, options);
|
|
34
|
+
const context = await createCommandContext(runtime, flags);
|
|
35
|
+
try {
|
|
36
|
+
await handler(context);
|
|
37
|
+
if (flags.json) writeJsonEvent(context.output, {
|
|
38
|
+
type: "success",
|
|
39
|
+
command: commandName,
|
|
40
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
41
|
+
result: null,
|
|
42
|
+
warnings: [],
|
|
43
|
+
nextSteps: []
|
|
44
|
+
});
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (error instanceof CliError) {
|
|
47
|
+
if (flags.json) writeJsonEvent(context.output, {
|
|
48
|
+
type: "error",
|
|
49
|
+
command: commandName,
|
|
50
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
51
|
+
error: cliErrorToJson(error),
|
|
52
|
+
warnings: [],
|
|
53
|
+
nextSteps: error.nextSteps
|
|
54
|
+
});
|
|
55
|
+
else writeHumanError(context.output, context.ui, error, { trace: flags.trace });
|
|
56
|
+
process.exitCode = error.exitCode;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
32
62
|
//#endregion
|
|
33
|
-
export { runCommand };
|
|
63
|
+
export { runCommand, runStreamingCommand };
|