@prisma/cli 3.0.0-dev.46.1 → 3.0.0-dev.47.1
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.
|
@@ -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
|
})));
|
|
@@ -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) {
|