@prisma/cli 3.0.0-beta.1 → 3.0.0-beta.2
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/controllers/app.js +16 -2
- package/dist/controllers/project.js +2 -0
- package/dist/lib/app/deploy-output.js +10 -1
- package/dist/lib/project/resolution.js +2 -1
- package/dist/lib/project/setup.js +2 -1
- package/dist/presenters/project.js +28 -28
- package/dist/use-cases/project.js +2 -1
- package/package.json +1 -1
package/dist/controllers/app.js
CHANGED
|
@@ -8,7 +8,7 @@ import { confirmPrompt, selectPrompt, textPrompt } from "../shell/prompt.js";
|
|
|
8
8
|
import { requireComputeAuth } from "../lib/auth/guard.js";
|
|
9
9
|
import { readAuthState } from "../lib/auth/auth-ops.js";
|
|
10
10
|
import { parseEnvAssignments } from "../lib/app/env-vars.js";
|
|
11
|
-
import { renderDeployOutputRows } from "../lib/app/deploy-output.js";
|
|
11
|
+
import { renderDeployOutputRows, renderDeploySettingsPreview } from "../lib/app/deploy-output.js";
|
|
12
12
|
import { readBunPackageEntrypoint, readBunPackageJson } from "../lib/app/bun-project.js";
|
|
13
13
|
import { DEFAULT_LOCAL_DEV_PORT, resolveLocalBuildType, runLocalApp } from "../lib/app/local-dev.js";
|
|
14
14
|
import { formatCommandArgument } from "../shell/command-arguments.js";
|
|
@@ -1629,10 +1629,14 @@ async function maybeCustomizeDeploySettings(context, options) {
|
|
|
1629
1629
|
framework: options.framework,
|
|
1630
1630
|
runtime: options.runtime
|
|
1631
1631
|
};
|
|
1632
|
+
maybeRenderDeploySettingsPreview(context, {
|
|
1633
|
+
framework: options.framework,
|
|
1634
|
+
runtime: options.runtime
|
|
1635
|
+
});
|
|
1632
1636
|
if (!await confirmPrompt({
|
|
1633
1637
|
input: context.runtime.stdin,
|
|
1634
1638
|
output: context.runtime.stderr,
|
|
1635
|
-
message: "Customize settings?",
|
|
1639
|
+
message: "Customize build settings?",
|
|
1636
1640
|
initialValue: false
|
|
1637
1641
|
})) return {
|
|
1638
1642
|
framework: options.framework,
|
|
@@ -1677,6 +1681,16 @@ async function maybeCustomizeDeploySettings(context, options) {
|
|
|
1677
1681
|
runtime
|
|
1678
1682
|
};
|
|
1679
1683
|
}
|
|
1684
|
+
function maybeRenderDeploySettingsPreview(context, options) {
|
|
1685
|
+
if (context.flags.quiet || context.flags.json) return;
|
|
1686
|
+
context.output.stderr.write(`Detected ${options.framework.displayName}\n${renderDeploySettingsPreview(context.ui, [{
|
|
1687
|
+
key: "framework",
|
|
1688
|
+
value: options.framework.displayName
|
|
1689
|
+
}, {
|
|
1690
|
+
key: "runtime",
|
|
1691
|
+
value: `HTTP ${options.runtime.port}`
|
|
1692
|
+
}]).join("\n")}\n\n`);
|
|
1693
|
+
}
|
|
1680
1694
|
function frameworkDisplayName(framework) {
|
|
1681
1695
|
switch (framework) {
|
|
1682
1696
|
case "nextjs": return "Next.js";
|
|
@@ -339,6 +339,7 @@ async function listRealWorkspaceProjects(client, workspace) {
|
|
|
339
339
|
return sortProjects((data?.data ?? []).filter((project) => project.workspace.id === workspace.id).map((project) => ({
|
|
340
340
|
id: project.id,
|
|
341
341
|
name: project.name,
|
|
342
|
+
..."url" in project && typeof project.url === "string" ? { url: project.url } : {},
|
|
342
343
|
slug: "slug" in project && typeof project.slug === "string" ? project.slug : null,
|
|
343
344
|
workspace: {
|
|
344
345
|
id: project.workspace.id,
|
|
@@ -350,6 +351,7 @@ function listFixtureWorkspaceProjects(context, workspace) {
|
|
|
350
351
|
return sortProjects(context.api.listProjectsForWorkspace(workspace.id).map((project) => ({
|
|
351
352
|
id: project.id,
|
|
352
353
|
name: project.name,
|
|
354
|
+
...project.url ? { url: project.url } : {},
|
|
353
355
|
slug: project.slug,
|
|
354
356
|
workspace
|
|
355
357
|
})));
|
|
@@ -2,6 +2,7 @@ import { padDisplay } from "../../shell/ui.js";
|
|
|
2
2
|
//#region src/lib/app/deploy-output.ts
|
|
3
3
|
const DEPLOY_OUTPUT_MIN_LABEL_WIDTH = 9;
|
|
4
4
|
const DEPLOY_OUTPUT_MIN_VALUE_WIDTH = 9;
|
|
5
|
+
const DEPLOY_SETTINGS_MIN_KEY_WIDTH = 10;
|
|
5
6
|
function renderDeployOutputRows(ui, rows) {
|
|
6
7
|
if (rows.length === 0) return [];
|
|
7
8
|
const labelWidth = Math.max(DEPLOY_OUTPUT_MIN_LABEL_WIDTH, ...rows.map((row) => row.label.length));
|
|
@@ -11,5 +12,13 @@ function renderDeployOutputRows(ui, rows) {
|
|
|
11
12
|
return ` ${padDisplay(row.label, labelWidth)} ${padDisplay(ui.strong(row.value), valueWidth)}${row.origin ? ` ${ui.dim(`· ${row.origin}`)}` : ""}`.trimEnd();
|
|
12
13
|
});
|
|
13
14
|
}
|
|
15
|
+
function renderDeploySettingsPreview(ui, rows) {
|
|
16
|
+
if (rows.length === 0) return [];
|
|
17
|
+
const keyWidth = Math.max(DEPLOY_SETTINGS_MIN_KEY_WIDTH, ...rows.map((row) => `${row.key}:`.length));
|
|
18
|
+
const rail = ui.dim("│");
|
|
19
|
+
return rows.map((row) => {
|
|
20
|
+
return `${rail} ${ui.accent(padDisplay(`${row.key}:`, keyWidth))} ${ui.strong(row.value)}`;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
14
23
|
//#endregion
|
|
15
|
-
export { renderDeployOutputRows };
|
|
24
|
+
export { renderDeployOutputRows, renderDeploySettingsPreview };
|
|
@@ -222,7 +222,8 @@ function buildProjectRecoveryCommands(commandName) {
|
|
|
222
222
|
function toProjectSummary(project) {
|
|
223
223
|
return {
|
|
224
224
|
id: project.id,
|
|
225
|
-
name: project.name
|
|
225
|
+
name: project.name,
|
|
226
|
+
...project.url ? { url: project.url } : {}
|
|
226
227
|
};
|
|
227
228
|
}
|
|
228
229
|
//#endregion
|
|
@@ -36,7 +36,8 @@ async function bindProjectToDirectory(context, workspace, project, action) {
|
|
|
36
36
|
function toProjectSummary(project) {
|
|
37
37
|
return {
|
|
38
38
|
id: project.id,
|
|
39
|
-
name: project.name
|
|
39
|
+
name: project.name,
|
|
40
|
+
...project.url ? { url: project.url } : {}
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
function projectSetupNameRequiredError(command) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { renderNextSteps, renderSummaryLine } from "../shell/ui.js";
|
|
1
|
+
import { padDisplay, renderNextSteps, renderSummaryLine } from "../shell/ui.js";
|
|
2
|
+
import { formatDescriptorLabel } from "../shell/command-meta.js";
|
|
2
3
|
import { formatCommandArgument } from "../shell/command-arguments.js";
|
|
3
4
|
import { renderList, renderMutate, renderShow, serializeList } from "../output/patterns.js";
|
|
5
|
+
import path from "node:path";
|
|
4
6
|
//#region src/presenters/project.ts
|
|
5
7
|
function renderProjectList(context, descriptor, result) {
|
|
6
8
|
const lines = renderList({
|
|
@@ -52,24 +54,7 @@ function renderProjectShow(context, descriptor, result) {
|
|
|
52
54
|
lines.push(...renderNextSteps(["Link an existing Project you choose: prisma-cli project link <id-or-name>", `Create a new Project: prisma-cli project create ${formatCommandArgument(result.suggestedProjectName)}`]));
|
|
53
55
|
return lines;
|
|
54
56
|
}
|
|
55
|
-
return
|
|
56
|
-
title: "Showing this directory's Project binding.",
|
|
57
|
-
descriptor,
|
|
58
|
-
fields: [
|
|
59
|
-
{
|
|
60
|
-
key: "workspace",
|
|
61
|
-
value: result.workspace.name
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
key: "project",
|
|
65
|
-
value: result.project.name
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
key: "resolution",
|
|
69
|
-
value: formatProjectSource(result.resolution.projectSource)
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
}, context.ui);
|
|
57
|
+
return renderBoundProjectShow(context, descriptor, result);
|
|
73
58
|
}
|
|
74
59
|
function serializeProjectShow(result) {
|
|
75
60
|
return result;
|
|
@@ -133,16 +118,31 @@ function renderGitDisconnect(context, descriptor, result) {
|
|
|
133
118
|
details: ["GitHub branch automation is no longer active for this project."]
|
|
134
119
|
}, context.ui);
|
|
135
120
|
}
|
|
136
|
-
function
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
121
|
+
function renderBoundProjectShow(context, descriptor, result) {
|
|
122
|
+
const { ui } = context;
|
|
123
|
+
const rail = ui.dim("│");
|
|
124
|
+
const keyWidth = 10;
|
|
125
|
+
const platform = `${result.workspace.name} / ${result.project.name}`;
|
|
126
|
+
const lines = [
|
|
127
|
+
`${ui.strong(formatDescriptorLabel(descriptor))} ${ui.dim("→")} ${ui.dim("This directory is linked to the following platform project.")}`,
|
|
128
|
+
"",
|
|
129
|
+
`${rail} ${ui.accent(padDisplay("local repo", keyWidth))} ${formatLocalRepoPath(context.runtime.cwd, context.runtime.env)}`,
|
|
130
|
+
`${rail} ${ui.accent(padDisplay("platform", keyWidth))} ${ui.strong(platform)}`
|
|
131
|
+
];
|
|
132
|
+
if (result.project.url) {
|
|
133
|
+
lines.push(rail);
|
|
134
|
+
lines.push(`${rail} ${ui.dim("→")} ${ui.link(result.project.url)}`);
|
|
135
|
+
}
|
|
136
|
+
return lines;
|
|
137
|
+
}
|
|
138
|
+
function formatLocalRepoPath(cwd, env) {
|
|
139
|
+
const resolved = path.resolve(cwd);
|
|
140
|
+
const home = env.HOME ? path.resolve(env.HOME) : null;
|
|
141
|
+
if (home && (resolved === home || resolved.startsWith(`${home}${path.sep}`))) {
|
|
142
|
+
const relative = path.relative(home, resolved);
|
|
143
|
+
return relative ? `~/${relative}` : "~";
|
|
145
144
|
}
|
|
145
|
+
return resolved;
|
|
146
146
|
}
|
|
147
147
|
function formatGitConnectionDetail(status) {
|
|
148
148
|
switch (status) {
|