@prisma-next/cli 0.11.0-dev.69 → 0.11.0-dev.70
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/cli.mjs +5 -5
- package/dist/commands/migrate.d.mts +1 -1
- package/dist/commands/migration-graph.d.mts +6 -4
- package/dist/commands/migration-graph.d.mts.map +1 -1
- package/dist/commands/migration-graph.mjs +1 -121
- package/dist/commands/migration-list.d.mts +4 -3
- package/dist/commands/migration-list.d.mts.map +1 -1
- package/dist/commands/migration-list.mjs +1 -1
- package/dist/commands/migration-log.d.mts +3 -3
- package/dist/commands/migration-plan.d.mts +1 -1
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.d.mts +1 -1
- package/dist/commands/migration-status.d.mts +1 -1
- package/dist/commands/ref.d.mts +1 -1
- package/dist/exports/control-api.d.mts +1 -1
- package/dist/exports/init-output.mjs +1 -1
- package/dist/{global-flags-2SPgqWma.d.mts → global-flags-DG4uY5tV.d.mts} +1 -1
- package/dist/{global-flags-2SPgqWma.d.mts.map → global-flags-DG4uY5tV.d.mts.map} +1 -1
- package/dist/{init-BQNpPozW.mjs → init-DE-phHWK.mjs} +2 -2
- package/dist/{init-BQNpPozW.mjs.map → init-DE-phHWK.mjs.map} +1 -1
- package/dist/migration-graph-kPluRdF2.mjs +1232 -0
- package/dist/migration-graph-kPluRdF2.mjs.map +1 -0
- package/dist/{migration-list-A3bJ4j5e.mjs → migration-list-CE35R5Ag.mjs} +2 -277
- package/dist/migration-list-CE35R5Ag.mjs.map +1 -0
- package/dist/migration-list-styler-DeAwACt3.mjs +402 -0
- package/dist/migration-list-styler-DeAwACt3.mjs.map +1 -0
- package/dist/{migration-plan-ZZm8C0s-.mjs → migration-plan-DHLa2Khm.mjs} +1 -1
- package/dist/{migration-plan-ZZm8C0s-.mjs.map → migration-plan-DHLa2Khm.mjs.map} +1 -1
- package/dist/{migration-types-q64xAI_J.d.mts → migration-types-CAQ-0TEE.d.mts} +1 -1
- package/dist/{migration-types-q64xAI_J.d.mts.map → migration-types-CAQ-0TEE.d.mts.map} +1 -1
- package/dist/{output-DEg3SSnJ.mjs → output-CF_hqzI-.mjs} +1 -1
- package/dist/{output-DEg3SSnJ.mjs.map → output-CF_hqzI-.mjs.map} +1 -1
- package/dist/{terminal-ui-sLZt2cxc.d.mts → terminal-ui-BbtqsQYY.d.mts} +1 -1
- package/dist/{terminal-ui-sLZt2cxc.d.mts.map → terminal-ui-BbtqsQYY.d.mts.map} +1 -1
- package/dist/{types-BNqTw3ek.d.mts → types-Ci7TndCS.d.mts} +1 -1
- package/dist/{types-BNqTw3ek.d.mts.map → types-Ci7TndCS.d.mts.map} +1 -1
- package/package.json +18 -18
- package/src/commands/migration-graph.ts +60 -19
- package/src/utils/formatters/migration-graph-layout.ts +1119 -0
- package/src/utils/formatters/migration-graph-rows.ts +336 -0
- package/src/utils/formatters/migration-graph-tree-render.ts +459 -0
- package/src/utils/formatters/migration-list-graph-topology.ts +245 -35
- package/src/utils/formatters/migration-list-styler.ts +9 -7
- package/dist/commands/migration-graph.mjs.map +0 -1
- package/dist/migration-list-A3bJ4j5e.mjs.map +0 -1
|
@@ -14,6 +14,9 @@ import {
|
|
|
14
14
|
import { buildReadAggregate } from '../utils/contract-space-aggregate-loader';
|
|
15
15
|
import { migrationGraphToRenderInput } from '../utils/formatters/graph-migration-mapper';
|
|
16
16
|
import { graphRenderer } from '../utils/formatters/graph-render';
|
|
17
|
+
import { buildMigrationGraphLayout } from '../utils/formatters/migration-graph-layout';
|
|
18
|
+
import { buildMigrationGraphRows } from '../utils/formatters/migration-graph-rows';
|
|
19
|
+
import { renderMigrationGraphTree } from '../utils/formatters/migration-graph-tree-render';
|
|
17
20
|
import { formatStyledHeader } from '../utils/formatters/styled';
|
|
18
21
|
import type { CommonCommandOptions } from '../utils/global-flags';
|
|
19
22
|
import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
@@ -24,6 +27,8 @@ import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
|
|
|
24
27
|
interface MigrationGraphOptions extends CommonCommandOptions {
|
|
25
28
|
readonly config?: string;
|
|
26
29
|
readonly dot?: boolean;
|
|
30
|
+
readonly tree?: boolean;
|
|
31
|
+
readonly ascii?: boolean;
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
export interface MigrationGraphResult {
|
|
@@ -85,14 +90,18 @@ export function createMigrationGraphCommand(): Command {
|
|
|
85
90
|
setCommandDescriptions(
|
|
86
91
|
command,
|
|
87
92
|
'Show the migration graph topology',
|
|
88
|
-
'Renders the migration graph
|
|
89
|
-
'
|
|
90
|
-
'--
|
|
93
|
+
'Renders the migration graph topology. Offline — does not consult\n' +
|
|
94
|
+
'the database. Use --tree for the condensed annotated tree\n' +
|
|
95
|
+
'(--ascii swaps box-drawing for pipe-friendly ASCII glyphs),\n' +
|
|
96
|
+
'--json for machine-readable output, or --dot for Graphviz DOT\n' +
|
|
97
|
+
'format.',
|
|
91
98
|
);
|
|
92
99
|
setCommandExamples(command, [
|
|
93
100
|
'prisma-next migration graph',
|
|
94
101
|
'prisma-next migration graph --json',
|
|
95
102
|
'prisma-next migration graph --dot',
|
|
103
|
+
'prisma-next migration graph --tree',
|
|
104
|
+
'prisma-next migration graph --tree --ascii',
|
|
96
105
|
]);
|
|
97
106
|
setCommandSeeAlso(command, [
|
|
98
107
|
{ verb: 'migration status', oneLiner: 'Show migration path and pending status' },
|
|
@@ -103,6 +112,8 @@ export function createMigrationGraphCommand(): Command {
|
|
|
103
112
|
addGlobalOptions(command)
|
|
104
113
|
.option('--config <path>', 'Path to prisma-next.config.ts')
|
|
105
114
|
.option('--dot', 'Output in Graphviz DOT format')
|
|
115
|
+
.option('--tree', 'Experimental condensed annotated tree renderer')
|
|
116
|
+
.option('--ascii', 'Use ASCII glyphs for --tree (pipe-friendly)')
|
|
106
117
|
.action(async (options: MigrationGraphOptions) => {
|
|
107
118
|
const flags = parseGlobalFlagsOrExit(options);
|
|
108
119
|
const ui = createTerminalUI(flags);
|
|
@@ -134,22 +145,52 @@ export function createMigrationGraphCommand(): Command {
|
|
|
134
145
|
JSON.stringify({ ok: true, nodes, edges, summary: graphResult.summary }, null, 2),
|
|
135
146
|
);
|
|
136
147
|
} else if (!flags.quiet) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
if (options.tree) {
|
|
149
|
+
const refsByHash = new Map<string, string[]>();
|
|
150
|
+
for (const ref of graphResult.refs) {
|
|
151
|
+
const existing = refsByHash.get(ref.hash);
|
|
152
|
+
refsByHash.set(ref.hash, existing ? [...existing, ref.name] : [ref.name]);
|
|
153
|
+
}
|
|
154
|
+
const rowModel = buildMigrationGraphRows(graphResult.graph, {
|
|
155
|
+
...(graphResult.contractHash !== null
|
|
156
|
+
? { contractHash: graphResult.contractHash }
|
|
157
|
+
: {}),
|
|
158
|
+
});
|
|
159
|
+
const layout = buildMigrationGraphLayout(rowModel);
|
|
160
|
+
const activeRef = graphResult.refs.find((ref) => ref.active);
|
|
161
|
+
const treeOutput = renderMigrationGraphTree(layout, {
|
|
162
|
+
refsByHash,
|
|
163
|
+
...(graphResult.contractHash !== null
|
|
164
|
+
? { contractHash: graphResult.contractHash }
|
|
165
|
+
: {}),
|
|
166
|
+
...(activeRef !== undefined ? { activeRefName: activeRef.name } : {}),
|
|
167
|
+
colorize: flags.color !== false,
|
|
168
|
+
glyphMode: ui.resolveGlyphMode(options.ascii === true),
|
|
169
|
+
});
|
|
170
|
+
// Emit the rendered tree to stdout like `migration list --graph`,
|
|
171
|
+
// not through clack's `log.message` rail: the graph is the command's
|
|
172
|
+
// result (and its own box-drawing is the only vertical structure it
|
|
173
|
+
// should carry), not a status line that needs the prompt gutter.
|
|
174
|
+
ui.output(treeOutput);
|
|
175
|
+
ui.output(`\n${graphResult.summary}`);
|
|
176
|
+
} else {
|
|
177
|
+
const renderInput = migrationGraphToRenderInput({
|
|
178
|
+
graph: graphResult.graph,
|
|
179
|
+
mode: 'offline',
|
|
180
|
+
markerHash: undefined,
|
|
181
|
+
contractHash: graphResult.contractHash ?? EMPTY_CONTRACT_HASH,
|
|
182
|
+
refs: graphResult.refs,
|
|
183
|
+
activeRefHash: undefined,
|
|
184
|
+
activeRefName: undefined,
|
|
185
|
+
edgeStatuses: [],
|
|
186
|
+
});
|
|
187
|
+
const graphOutput = graphRenderer.render(renderInput.graph, {
|
|
188
|
+
...renderInput.options,
|
|
189
|
+
colorize: flags.color !== false,
|
|
190
|
+
});
|
|
191
|
+
ui.log(graphOutput);
|
|
192
|
+
ui.log(`\n${graphResult.summary}`);
|
|
193
|
+
}
|
|
153
194
|
}
|
|
154
195
|
});
|
|
155
196
|
process.exit(exitCode);
|