@prisma-next/cli 0.10.0-dev.23 → 0.10.0-dev.24
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-errors-CF60g2cG.mjs → cli-errors-Djtz98Vm.mjs} +3 -3
- package/dist/cli-errors-Djtz98Vm.mjs.map +1 -0
- package/dist/cli.mjs +9 -10
- package/dist/cli.mjs.map +1 -1
- package/dist/{client-BbsiOKZN.mjs → client-oXO2WCPD.mjs} +4 -4
- package/dist/{client-BbsiOKZN.mjs.map → client-oXO2WCPD.mjs.map} +1 -1
- package/dist/{command-helpers-Dvgul7UA.mjs → command-helpers-BSb0tRC8.mjs} +103 -9
- package/dist/command-helpers-BSb0tRC8.mjs.map +1 -0
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.mjs +8 -12
- package/dist/commands/db-init.mjs.map +1 -1
- package/dist/commands/db-schema.mjs +6 -10
- package/dist/commands/db-schema.mjs.map +1 -1
- package/dist/commands/db-sign.mjs +7 -11
- package/dist/commands/db-sign.mjs.map +1 -1
- package/dist/commands/db-update.mjs +8 -12
- package/dist/commands/db-update.mjs.map +1 -1
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +1 -1
- package/dist/commands/migrate.mjs +7 -11
- package/dist/commands/migrate.mjs.map +1 -1
- package/dist/commands/migration-check.mjs +4 -7
- package/dist/commands/migration-check.mjs.map +1 -1
- package/dist/commands/migration-graph.d.mts +1 -1
- package/dist/commands/migration-graph.mjs +6 -10
- package/dist/commands/migration-graph.mjs.map +1 -1
- package/dist/commands/migration-list.mjs +5 -9
- package/dist/commands/migration-list.mjs.map +1 -1
- package/dist/commands/migration-log.mjs +6 -10
- package/dist/commands/migration-log.mjs.map +1 -1
- package/dist/commands/migration-new.mjs +6 -10
- package/dist/commands/migration-new.mjs.map +1 -1
- 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-show.mjs +8 -12
- package/dist/commands/migration-show.mjs.map +1 -1
- package/dist/commands/migration-status.d.mts +1 -1
- package/dist/commands/migration-status.mjs +9 -13
- package/dist/commands/migration-status.mjs.map +1 -1
- package/dist/commands/ref.d.mts +1 -1
- package/dist/commands/ref.mjs +9 -19
- package/dist/commands/ref.mjs.map +1 -1
- package/dist/{contract-emit-iynA3BCA.mjs → contract-emit-bcrpT-wD.mjs} +3 -3
- package/dist/{contract-emit-iynA3BCA.mjs.map → contract-emit-bcrpT-wD.mjs.map} +1 -1
- package/dist/{contract-emit-BDBzHlaC.mjs → contract-emit-r4y8Zhf1.mjs} +7 -12
- package/dist/contract-emit-r4y8Zhf1.mjs.map +1 -0
- package/dist/{contract-infer-DsgNf-d7.mjs → contract-infer-BmySmqVT.mjs} +8 -13
- package/dist/contract-infer-BmySmqVT.mjs.map +1 -0
- package/dist/{contract-space-aggregate-loader-pAc8CDfY.mjs → contract-space-aggregate-loader-BmNQwlws.mjs} +2 -2
- package/dist/{contract-space-aggregate-loader-pAc8CDfY.mjs.map → contract-space-aggregate-loader-BmNQwlws.mjs.map} +1 -1
- package/dist/{db-verify-BfsmBkd4.mjs → db-verify-BClPs3ph.mjs} +8 -12
- package/dist/db-verify-BClPs3ph.mjs.map +1 -0
- package/dist/exports/control-api.d.mts +1 -1
- package/dist/exports/control-api.mjs +2 -2
- package/dist/exports/index.mjs +1 -1
- package/dist/exports/init-output.mjs +1 -1
- package/dist/{framework-components-xFLFpZUO.mjs → framework-components-65gOHkHB.mjs} +2 -2
- package/dist/{framework-components-xFLFpZUO.mjs.map → framework-components-65gOHkHB.mjs.map} +1 -1
- package/dist/{global-flags-DGmw6Kqg.d.mts → global-flags-CdE7M0d9.d.mts} +4 -1
- package/dist/global-flags-CdE7M0d9.d.mts.map +1 -0
- package/dist/{graph-render-eJDcLWny.mjs → graph-render-DJVv0_uf.mjs} +1 -1
- package/dist/{graph-render-eJDcLWny.mjs.map → graph-render-DJVv0_uf.mjs.map} +1 -1
- package/dist/{init-CHaTgMQg.mjs → init-CQ-84_iO.mjs} +6 -11
- package/dist/{init-CHaTgMQg.mjs.map → init-CQ-84_iO.mjs.map} +1 -1
- package/dist/{inspect-live-schema-DyQVuLw6.mjs → inspect-live-schema-DSRbFoOL.mjs} +4 -4
- package/dist/{inspect-live-schema-DyQVuLw6.mjs.map → inspect-live-schema-DSRbFoOL.mjs.map} +1 -1
- package/dist/{migration-command-scaffold--ZwMgOD_.mjs → migration-command-scaffold-Bzd9La5c.mjs} +4 -4
- package/dist/{migration-command-scaffold--ZwMgOD_.mjs.map → migration-command-scaffold-Bzd9La5c.mjs.map} +1 -1
- package/dist/{migration-plan-BSzcWsvm.mjs → migration-plan-CFwqw3Gk.mjs} +8 -12
- package/dist/migration-plan-CFwqw3Gk.mjs.map +1 -0
- package/dist/{migration-types-D2FW63pr.d.mts → migration-types-BXWvz12q.d.mts} +1 -1
- package/dist/{migration-types-D2FW63pr.d.mts.map → migration-types-BXWvz12q.d.mts.map} +1 -1
- package/dist/{migrations-CgANWI0w.mjs → migrations-CwZMa1Ck.mjs} +2 -2
- package/dist/{migrations-CgANWI0w.mjs.map → migrations-CwZMa1Ck.mjs.map} +1 -1
- package/dist/{output-B60Gw5fu.mjs → output-BlsrGMEF.mjs} +1 -1
- package/dist/{output-B60Gw5fu.mjs.map → output-BlsrGMEF.mjs.map} +1 -1
- package/dist/{terminal-ui-XtOQsqe9.mjs → terminal-ui-BiB_8KNo.mjs} +131 -24
- package/dist/terminal-ui-BiB_8KNo.mjs.map +1 -0
- package/dist/{types-0aS865QN.d.mts → types--CqjMdk0.d.mts} +2 -2
- package/dist/{types-0aS865QN.d.mts.map → types--CqjMdk0.d.mts.map} +1 -1
- package/dist/{verify-nlzO0uIY.mjs → verify-Bom75OYI.mjs} +2 -2
- package/dist/{verify-nlzO0uIY.mjs.map → verify-Bom75OYI.mjs.map} +1 -1
- package/package.json +18 -18
- package/src/commands/contract-emit.ts +4 -4
- package/src/commands/contract-infer.ts +6 -6
- package/src/commands/db-init.ts +4 -4
- package/src/commands/db-schema.ts +4 -4
- package/src/commands/db-sign.ts +4 -4
- package/src/commands/db-update.ts +4 -4
- package/src/commands/db-verify.ts +4 -4
- package/src/commands/init/index.ts +2 -2
- package/src/commands/init/init.ts +2 -2
- package/src/commands/migrate.ts +4 -7
- package/src/commands/migration-check.ts +4 -4
- package/src/commands/migration-graph.ts +4 -4
- package/src/commands/migration-list.ts +4 -4
- package/src/commands/migration-log.ts +4 -4
- package/src/commands/migration-new.ts +4 -4
- package/src/commands/migration-plan.ts +4 -4
- package/src/commands/migration-show.ts +4 -4
- package/src/commands/migration-status.ts +4 -4
- package/src/commands/ref.ts +8 -8
- package/src/utils/cli-errors.ts +4 -0
- package/src/utils/command-helpers.ts +6 -2
- package/src/utils/global-flags.ts +102 -17
- package/src/utils/terminal-ui.ts +44 -23
- package/dist/cli-errors-CF60g2cG.mjs.map +0 -1
- package/dist/command-helpers-Dvgul7UA.mjs.map +0 -1
- package/dist/contract-emit-BDBzHlaC.mjs.map +0 -1
- package/dist/contract-infer-DsgNf-d7.mjs.map +0 -1
- package/dist/db-verify-BfsmBkd4.mjs.map +0 -1
- package/dist/errors-BYAXmyRJ.mjs +0 -56
- package/dist/errors-BYAXmyRJ.mjs.map +0 -1
- package/dist/global-flags-DGmw6Kqg.d.mts.map +0 -1
- package/dist/is-ci-YyvQBBke.mjs +0 -44
- package/dist/is-ci-YyvQBBke.mjs.map +0 -1
- package/dist/migration-plan-BSzcWsvm.mjs.map +0 -1
- package/dist/result-handler-CG3vVoKf.mjs +0 -25
- package/dist/result-handler-CG3vVoKf.mjs.map +0 -1
- package/dist/terminal-ui-XtOQsqe9.mjs.map +0 -1
- /package/dist/{cli-errors-DdcjVLJV.d.mts → cli-errors-Czmx92Zy.d.mts} +0 -0
package/src/commands/db-init.ts
CHANGED
|
@@ -24,13 +24,13 @@ import {
|
|
|
24
24
|
formatMigrationPlanOutput,
|
|
25
25
|
type MigrationCommandResult,
|
|
26
26
|
} from '../utils/formatters/migrations';
|
|
27
|
-
import { type GlobalFlags,
|
|
27
|
+
import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
28
28
|
import {
|
|
29
29
|
addMigrationCommandOptions,
|
|
30
30
|
prepareMigrationContext,
|
|
31
31
|
} from '../utils/migration-command-scaffold';
|
|
32
32
|
import { handleResult } from '../utils/result-handler';
|
|
33
|
-
import { TerminalUI } from '../utils/terminal-ui';
|
|
33
|
+
import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
|
|
34
34
|
|
|
35
35
|
type DbInitOptions = MigrationCommandOptions;
|
|
36
36
|
|
|
@@ -230,10 +230,10 @@ export function createDbInitCommand(): Command {
|
|
|
230
230
|
]);
|
|
231
231
|
addMigrationCommandOptions(command);
|
|
232
232
|
command.action(async (options: DbInitOptions) => {
|
|
233
|
-
const flags =
|
|
233
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
234
234
|
const startTime = Date.now();
|
|
235
235
|
|
|
236
|
-
const ui =
|
|
236
|
+
const ui = createTerminalUI(flags);
|
|
237
237
|
|
|
238
238
|
const result = await executeDbInitCommand(options, flags, ui, startTime);
|
|
239
239
|
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
setCommandExamples,
|
|
7
7
|
} from '../utils/command-helpers';
|
|
8
8
|
import { formatIntrospectJson, formatIntrospectOutput } from '../utils/formatters/verify';
|
|
9
|
-
import {
|
|
9
|
+
import { parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
10
10
|
import { handleResult } from '../utils/result-handler';
|
|
11
|
-
import {
|
|
11
|
+
import { createTerminalUI } from '../utils/terminal-ui';
|
|
12
12
|
import {
|
|
13
13
|
type InspectLiveSchemaOptions,
|
|
14
14
|
type InspectLiveSchemaResult,
|
|
@@ -46,8 +46,8 @@ export function createDbSchemaCommand(): Command {
|
|
|
46
46
|
.option('--db <url>', 'Database connection string')
|
|
47
47
|
.option('--config <path>', 'Path to prisma-next.config.ts')
|
|
48
48
|
.action(async (options: InspectLiveSchemaOptions) => {
|
|
49
|
-
const flags =
|
|
50
|
-
const ui =
|
|
49
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
50
|
+
const ui = createTerminalUI(flags);
|
|
51
51
|
const startTime = Date.now();
|
|
52
52
|
|
|
53
53
|
const result = await inspectLiveSchema(options, flags, ui, startTime, {
|
package/src/commands/db-sign.ts
CHANGED
|
@@ -40,10 +40,10 @@ import {
|
|
|
40
40
|
formatSignOutput,
|
|
41
41
|
} from '../utils/formatters/verify';
|
|
42
42
|
import type { CommonCommandOptions } from '../utils/global-flags';
|
|
43
|
-
import { type GlobalFlags,
|
|
43
|
+
import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
44
44
|
import { createProgressAdapter } from '../utils/progress-adapter';
|
|
45
45
|
import { handleResult } from '../utils/result-handler';
|
|
46
|
-
import { TerminalUI } from '../utils/terminal-ui';
|
|
46
|
+
import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
|
|
47
47
|
|
|
48
48
|
interface DbSignOptions extends CommonCommandOptions {
|
|
49
49
|
readonly db?: string;
|
|
@@ -270,7 +270,7 @@ export function createDbSignCommand(): Command {
|
|
|
270
270
|
'Contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)',
|
|
271
271
|
)
|
|
272
272
|
.action(async (positionalContract: string | undefined, options: DbSignOptions) => {
|
|
273
|
-
const flags =
|
|
273
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
274
274
|
|
|
275
275
|
if (positionalContract && options.contract) {
|
|
276
276
|
process.stderr.write(
|
|
@@ -280,7 +280,7 @@ export function createDbSignCommand(): Command {
|
|
|
280
280
|
return;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
const ui =
|
|
283
|
+
const ui = createTerminalUI(flags);
|
|
284
284
|
|
|
285
285
|
const result = await executeDbSignCommand(positionalContract, options, flags, ui);
|
|
286
286
|
|
|
@@ -33,13 +33,13 @@ import {
|
|
|
33
33
|
formatMigrationPlanOutput,
|
|
34
34
|
type MigrationCommandResult,
|
|
35
35
|
} from '../utils/formatters/migrations';
|
|
36
|
-
import { type GlobalFlags,
|
|
36
|
+
import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
37
37
|
import {
|
|
38
38
|
addMigrationCommandOptions,
|
|
39
39
|
prepareMigrationContext,
|
|
40
40
|
} from '../utils/migration-command-scaffold';
|
|
41
41
|
import { handleResult } from '../utils/result-handler';
|
|
42
|
-
import { TerminalUI } from '../utils/terminal-ui';
|
|
42
|
+
import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
|
|
43
43
|
|
|
44
44
|
interface DbUpdateOptions extends MigrationCommandOptions {
|
|
45
45
|
readonly to?: string;
|
|
@@ -246,10 +246,10 @@ export function createDbUpdateCommand(): Command {
|
|
|
246
246
|
'Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)',
|
|
247
247
|
);
|
|
248
248
|
command.action(async (options: DbUpdateOptions) => {
|
|
249
|
-
const flags =
|
|
249
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
250
250
|
const startTime = Date.now();
|
|
251
251
|
|
|
252
|
-
const ui =
|
|
252
|
+
const ui = createTerminalUI(flags);
|
|
253
253
|
|
|
254
254
|
let result = await executeDbUpdateCommand(options, flags, ui, startTime);
|
|
255
255
|
|
|
@@ -47,10 +47,10 @@ import {
|
|
|
47
47
|
formatVerifyOutput,
|
|
48
48
|
} from '../utils/formatters/verify';
|
|
49
49
|
import type { CommonCommandOptions } from '../utils/global-flags';
|
|
50
|
-
import { type GlobalFlags,
|
|
50
|
+
import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
51
51
|
import { createProgressAdapter } from '../utils/progress-adapter';
|
|
52
52
|
import { handleResult } from '../utils/result-handler';
|
|
53
|
-
import { TerminalUI } from '../utils/terminal-ui';
|
|
53
|
+
import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
|
|
54
54
|
|
|
55
55
|
interface DbVerifyOptions extends CommonCommandOptions {
|
|
56
56
|
readonly db?: string;
|
|
@@ -529,8 +529,8 @@ export function createDbVerifyCommand(): Command {
|
|
|
529
529
|
false,
|
|
530
530
|
)
|
|
531
531
|
.action(async (options: DbVerifyOptions) => {
|
|
532
|
-
const flags =
|
|
533
|
-
const ui =
|
|
532
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
533
|
+
const ui = createTerminalUI(flags);
|
|
534
534
|
|
|
535
535
|
const modeResult = resolveDbVerifyMode(options);
|
|
536
536
|
if (!modeResult.ok) {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
setCommandDescriptions,
|
|
5
5
|
setCommandExamples,
|
|
6
6
|
} from '../../utils/command-helpers';
|
|
7
|
-
import { type CommonCommandOptions,
|
|
7
|
+
import { type CommonCommandOptions, parseGlobalFlagsOrExit } from '../../utils/global-flags';
|
|
8
8
|
import { fireTelemetryAfterInitConsent } from '../../utils/telemetry';
|
|
9
9
|
import {
|
|
10
10
|
INIT_EXIT_EMIT_FAILED,
|
|
@@ -94,7 +94,7 @@ export function createInitCommand(): Command {
|
|
|
94
94
|
)
|
|
95
95
|
.action(async (options: InitCommandOptions, actionCommand: Command) => {
|
|
96
96
|
const { runInit } = await import('./init');
|
|
97
|
-
const flags =
|
|
97
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
98
98
|
const canPrompt = deriveCanPrompt({
|
|
99
99
|
flagsInteractive: flags.interactive,
|
|
100
100
|
optionInteractive: options.interactive,
|
|
@@ -6,7 +6,7 @@ import { basename, dirname, isAbsolute, join } from 'pathe';
|
|
|
6
6
|
import { CliStructuredError } from '../../utils/cli-errors';
|
|
7
7
|
import { formatErrorJson, formatErrorOutput } from '../../utils/formatters/errors';
|
|
8
8
|
import type { GlobalFlags } from '../../utils/global-flags';
|
|
9
|
-
import { TerminalUI } from '../../utils/terminal-ui';
|
|
9
|
+
import { createTerminalUI, type TerminalUI } from '../../utils/terminal-ui';
|
|
10
10
|
import {
|
|
11
11
|
detectPackageManager,
|
|
12
12
|
formatAddArgs,
|
|
@@ -131,7 +131,7 @@ export async function runInit(
|
|
|
131
131
|
},
|
|
132
132
|
): Promise<number> {
|
|
133
133
|
const { options, flags, canPrompt, probeOverrides, afterFirstTelemetryConsent } = runOptions;
|
|
134
|
-
const ui =
|
|
134
|
+
const ui = createTerminalUI(flags);
|
|
135
135
|
const warnings: string[] = [];
|
|
136
136
|
const filesWritten: string[] = [];
|
|
137
137
|
const filesDeleted: string[] = [];
|
package/src/commands/migrate.ts
CHANGED
|
@@ -43,9 +43,9 @@ import {
|
|
|
43
43
|
import { formatMigrationApplyCommandOutput } from '../utils/formatters/migrations';
|
|
44
44
|
import { formatStyledHeader } from '../utils/formatters/styled';
|
|
45
45
|
import type { CommonCommandOptions } from '../utils/global-flags';
|
|
46
|
-
import { type GlobalFlags,
|
|
46
|
+
import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
47
47
|
import { handleResult } from '../utils/result-handler';
|
|
48
|
-
import { TerminalUI } from '../utils/terminal-ui';
|
|
48
|
+
import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
|
|
49
49
|
|
|
50
50
|
interface MigrateCommandOptions extends CommonCommandOptions {
|
|
51
51
|
readonly db?: string;
|
|
@@ -319,13 +319,10 @@ export function createMigrateCommand(): Command {
|
|
|
319
319
|
'Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)',
|
|
320
320
|
)
|
|
321
321
|
.action(async (options: MigrateCommandOptions) => {
|
|
322
|
-
const flags =
|
|
322
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
323
323
|
const startTime = Date.now();
|
|
324
324
|
|
|
325
|
-
const ui =
|
|
326
|
-
color: flags.color,
|
|
327
|
-
interactive: flags.interactive,
|
|
328
|
-
});
|
|
325
|
+
const ui = createTerminalUI(flags);
|
|
329
326
|
|
|
330
327
|
const result = await executeMigrateCommand(options, flags, ui, startTime);
|
|
331
328
|
|
|
@@ -17,8 +17,8 @@ import {
|
|
|
17
17
|
} from '../utils/command-helpers';
|
|
18
18
|
import { formatStyledHeader } from '../utils/formatters/styled';
|
|
19
19
|
import type { CommonCommandOptions } from '../utils/global-flags';
|
|
20
|
-
import { type GlobalFlags,
|
|
21
|
-
import { TerminalUI } from '../utils/terminal-ui';
|
|
20
|
+
import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
21
|
+
import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
|
|
22
22
|
import { INTEGRITY_FAILED, OK, PRECONDITION } from './migration-check/exit-codes';
|
|
23
23
|
|
|
24
24
|
interface MigrationCheckOptions extends CommonCommandOptions {
|
|
@@ -335,8 +335,8 @@ export function createMigrationCheckCommand(): Command {
|
|
|
335
335
|
.argument('[migration]', 'Migration reference (directory name or hash) to check')
|
|
336
336
|
.option('--config <path>', 'Path to prisma-next.config.ts')
|
|
337
337
|
.action(async (target: string | undefined, options: MigrationCheckOptions) => {
|
|
338
|
-
const flags =
|
|
339
|
-
const ui =
|
|
338
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
339
|
+
const ui = createTerminalUI(flags);
|
|
340
340
|
|
|
341
341
|
let result: MigrationCheckResult;
|
|
342
342
|
let exitCode: number;
|
|
@@ -23,10 +23,10 @@ import { migrationGraphToRenderInput } from '../utils/formatters/graph-migration
|
|
|
23
23
|
import { graphRenderer } from '../utils/formatters/graph-render';
|
|
24
24
|
import { formatStyledHeader } from '../utils/formatters/styled';
|
|
25
25
|
import type { CommonCommandOptions } from '../utils/global-flags';
|
|
26
|
-
import { type GlobalFlags,
|
|
26
|
+
import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
27
27
|
import type { StatusRef } from '../utils/migration-types';
|
|
28
28
|
import { handleResult } from '../utils/result-handler';
|
|
29
|
-
import { TerminalUI } from '../utils/terminal-ui';
|
|
29
|
+
import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
|
|
30
30
|
|
|
31
31
|
interface MigrationGraphOptions extends CommonCommandOptions {
|
|
32
32
|
readonly config?: string;
|
|
@@ -130,8 +130,8 @@ export function createMigrationGraphCommand(): Command {
|
|
|
130
130
|
.option('--config <path>', 'Path to prisma-next.config.ts')
|
|
131
131
|
.option('--dot', 'Output in Graphviz DOT format')
|
|
132
132
|
.action(async (options: MigrationGraphOptions) => {
|
|
133
|
-
const flags =
|
|
134
|
-
const ui =
|
|
133
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
134
|
+
const ui = createTerminalUI(flags);
|
|
135
135
|
const result = await executeMigrationGraphCommand(options, flags, ui);
|
|
136
136
|
const exitCode = handleResult(result, flags, ui, (graphResult) => {
|
|
137
137
|
// Explicit format flags win over the auto-JSON default. `flags.json`
|
|
@@ -20,9 +20,9 @@ import {
|
|
|
20
20
|
} from '../utils/command-helpers';
|
|
21
21
|
import { formatStyledHeader } from '../utils/formatters/styled';
|
|
22
22
|
import type { CommonCommandOptions } from '../utils/global-flags';
|
|
23
|
-
import { type GlobalFlags,
|
|
23
|
+
import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
24
24
|
import { handleResult } from '../utils/result-handler';
|
|
25
|
-
import { TerminalUI } from '../utils/terminal-ui';
|
|
25
|
+
import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
|
|
26
26
|
|
|
27
27
|
interface MigrationListOptions extends CommonCommandOptions {
|
|
28
28
|
readonly config?: string;
|
|
@@ -130,8 +130,8 @@ export function createMigrationListCommand(): Command {
|
|
|
130
130
|
addGlobalOptions(command)
|
|
131
131
|
.option('--config <path>', 'Path to prisma-next.config.ts')
|
|
132
132
|
.action(async (options: MigrationListOptions) => {
|
|
133
|
-
const flags =
|
|
134
|
-
const ui =
|
|
133
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
134
|
+
const ui = createTerminalUI(flags);
|
|
135
135
|
const result = await executeMigrationListCommand(options, flags, ui);
|
|
136
136
|
const exitCode = handleResult(result, flags, ui, (listResult) => {
|
|
137
137
|
if (flags.json) {
|
|
@@ -26,9 +26,9 @@ import {
|
|
|
26
26
|
} from '../utils/command-helpers';
|
|
27
27
|
import { formatStyledHeader } from '../utils/formatters/styled';
|
|
28
28
|
import type { CommonCommandOptions } from '../utils/global-flags';
|
|
29
|
-
import { type GlobalFlags,
|
|
29
|
+
import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
30
30
|
import { handleResult } from '../utils/result-handler';
|
|
31
|
-
import { TerminalUI } from '../utils/terminal-ui';
|
|
31
|
+
import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
|
|
32
32
|
|
|
33
33
|
interface MigrationLogOptions extends CommonCommandOptions {
|
|
34
34
|
readonly db?: string;
|
|
@@ -193,8 +193,8 @@ export function createMigrationLogCommand(): Command {
|
|
|
193
193
|
.option('--db <url>', 'Database connection string')
|
|
194
194
|
.option('--config <path>', 'Path to prisma-next.config.ts')
|
|
195
195
|
.action(async (options: MigrationLogOptions) => {
|
|
196
|
-
const flags =
|
|
197
|
-
const ui =
|
|
196
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
197
|
+
const ui = createTerminalUI(flags);
|
|
198
198
|
const result = await executeMigrationLogCommand(options, flags, ui);
|
|
199
199
|
const exitCode = handleResult(result, flags, ui, (logResult) => {
|
|
200
200
|
if (flags.json) {
|
|
@@ -49,9 +49,9 @@ import {
|
|
|
49
49
|
import { formatStyledHeader } from '../utils/formatters/styled';
|
|
50
50
|
import { assertFrameworkComponentsCompatible } from '../utils/framework-components';
|
|
51
51
|
import type { CommonCommandOptions } from '../utils/global-flags';
|
|
52
|
-
import {
|
|
52
|
+
import { parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
53
53
|
import { handleResult } from '../utils/result-handler';
|
|
54
|
-
import {
|
|
54
|
+
import { createTerminalUI } from '../utils/terminal-ui';
|
|
55
55
|
|
|
56
56
|
interface MigrationNewOptions extends CommonCommandOptions {
|
|
57
57
|
readonly name?: string;
|
|
@@ -287,8 +287,8 @@ export function createMigrationNewCommand(): Command {
|
|
|
287
287
|
.option('--from <hash>', 'Starting contract hash (default: latest migration target)')
|
|
288
288
|
.option('--config <path>', 'Path to prisma-next.config.ts')
|
|
289
289
|
.action(async (options: MigrationNewOptions) => {
|
|
290
|
-
const flags =
|
|
291
|
-
const ui =
|
|
290
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
291
|
+
const ui = createTerminalUI(flags);
|
|
292
292
|
|
|
293
293
|
if (!flags.json && !flags.quiet) {
|
|
294
294
|
const header = formatStyledHeader({
|
|
@@ -51,9 +51,9 @@ import { toExtensionInputs } from '../utils/extension-pack-inputs';
|
|
|
51
51
|
import { formatStyledHeader } from '../utils/formatters/styled';
|
|
52
52
|
import { assertFrameworkComponentsCompatible } from '../utils/framework-components';
|
|
53
53
|
import type { CommonCommandOptions } from '../utils/global-flags';
|
|
54
|
-
import { type GlobalFlags,
|
|
54
|
+
import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
55
55
|
import { handleResult } from '../utils/result-handler';
|
|
56
|
-
import { TerminalUI } from '../utils/terminal-ui';
|
|
56
|
+
import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
|
|
57
57
|
|
|
58
58
|
interface MigrationPlanOptions extends CommonCommandOptions {
|
|
59
59
|
readonly config?: string;
|
|
@@ -551,10 +551,10 @@ export function createMigrationPlanCommand(): Command {
|
|
|
551
551
|
'Starting contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)',
|
|
552
552
|
)
|
|
553
553
|
.action(async (options: MigrationPlanOptions) => {
|
|
554
|
-
const flags =
|
|
554
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
555
555
|
const startTime = Date.now();
|
|
556
556
|
|
|
557
|
-
const ui =
|
|
557
|
+
const ui = createTerminalUI(flags);
|
|
558
558
|
const result = await executeMigrationPlanCommand(options, flags, ui, startTime);
|
|
559
559
|
|
|
560
560
|
const exitCode = handleResult(result, flags, ui, (planResult) => {
|
|
@@ -43,9 +43,9 @@ import { buildContractSpaceAggregate } from '../utils/contract-space-aggregate-l
|
|
|
43
43
|
import { formatMigrationShowOutput } from '../utils/formatters/migrations';
|
|
44
44
|
import { formatStyledHeader } from '../utils/formatters/styled';
|
|
45
45
|
import type { CommonCommandOptions } from '../utils/global-flags';
|
|
46
|
-
import { type GlobalFlags,
|
|
46
|
+
import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
47
47
|
import { handleResult } from '../utils/result-handler';
|
|
48
|
-
import { TerminalUI } from '../utils/terminal-ui';
|
|
48
|
+
import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
|
|
49
49
|
|
|
50
50
|
interface MigrationShowOptions extends CommonCommandOptions {
|
|
51
51
|
readonly config?: string;
|
|
@@ -495,9 +495,9 @@ export function createMigrationShowCommand(): Command {
|
|
|
495
495
|
)
|
|
496
496
|
.option('--config <path>', 'Path to prisma-next.config.ts')
|
|
497
497
|
.action(async (target: string | undefined, options: MigrationShowOptions) => {
|
|
498
|
-
const flags =
|
|
498
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
499
499
|
|
|
500
|
-
const ui =
|
|
500
|
+
const ui = createTerminalUI(flags);
|
|
501
501
|
|
|
502
502
|
const result = await executeMigrationShowCommand(target, options, flags, ui);
|
|
503
503
|
|
|
@@ -65,10 +65,10 @@ import {
|
|
|
65
65
|
} from '../utils/formatters/graph-render';
|
|
66
66
|
import { formatStyledHeader } from '../utils/formatters/styled';
|
|
67
67
|
import type { CommonCommandOptions } from '../utils/global-flags';
|
|
68
|
-
import { type GlobalFlags,
|
|
68
|
+
import { type GlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
69
69
|
import type { StatusDiagnostic, StatusRef } from '../utils/migration-types';
|
|
70
70
|
import { handleResult } from '../utils/result-handler';
|
|
71
|
-
import { TerminalUI } from '../utils/terminal-ui';
|
|
71
|
+
import { createTerminalUI, type TerminalUI } from '../utils/terminal-ui';
|
|
72
72
|
|
|
73
73
|
interface MigrationStatusOptions extends CommonCommandOptions {
|
|
74
74
|
readonly db?: string;
|
|
@@ -1140,8 +1140,8 @@ export function createMigrationStatusCommand(): Command {
|
|
|
1140
1140
|
'Origin contract reference; same grammar as --to. Supplying --from switches to offline path computation.',
|
|
1141
1141
|
)
|
|
1142
1142
|
.action(async (options: MigrationStatusOptions) => {
|
|
1143
|
-
const flags =
|
|
1144
|
-
const ui =
|
|
1143
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
1144
|
+
const ui = createTerminalUI(flags);
|
|
1145
1145
|
|
|
1146
1146
|
const result = await executeMigrationStatusCommand(options, flags, ui);
|
|
1147
1147
|
|
package/src/commands/ref.ts
CHANGED
|
@@ -25,9 +25,9 @@ import {
|
|
|
25
25
|
setCommandDescriptions,
|
|
26
26
|
} from '../utils/command-helpers';
|
|
27
27
|
import { formatCommandHelp } from '../utils/formatters/help';
|
|
28
|
-
import { parseGlobalFlags } from '../utils/global-flags';
|
|
28
|
+
import { parseGlobalFlags, parseGlobalFlagsOrExit } from '../utils/global-flags';
|
|
29
29
|
import { handleResult } from '../utils/result-handler';
|
|
30
|
-
import {
|
|
30
|
+
import { createTerminalUI } from '../utils/terminal-ui';
|
|
31
31
|
|
|
32
32
|
interface RefSetResult {
|
|
33
33
|
readonly ok: true;
|
|
@@ -145,8 +145,8 @@ function createRefSetCommand(): Command {
|
|
|
145
145
|
hash: string,
|
|
146
146
|
options: { config?: string; json?: string | boolean; quiet?: boolean },
|
|
147
147
|
) => {
|
|
148
|
-
const flags =
|
|
149
|
-
const ui =
|
|
148
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
149
|
+
const ui = createTerminalUI(flags);
|
|
150
150
|
const result = await executeRefSetCommand(name, hash, options);
|
|
151
151
|
const exitCode = handleResult(result, flags, ui, (value) => {
|
|
152
152
|
if (flags.json) {
|
|
@@ -172,8 +172,8 @@ function createRefDeleteCommand(): Command {
|
|
|
172
172
|
name: string,
|
|
173
173
|
options: { config?: string; json?: string | boolean; quiet?: boolean },
|
|
174
174
|
) => {
|
|
175
|
-
const flags =
|
|
176
|
-
const ui =
|
|
175
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
176
|
+
const ui = createTerminalUI(flags);
|
|
177
177
|
const result = await executeRefDeleteCommand(name, options);
|
|
178
178
|
const exitCode = handleResult(result, flags, ui, (value) => {
|
|
179
179
|
if (flags.json) {
|
|
@@ -194,8 +194,8 @@ function createRefListCommand(): Command {
|
|
|
194
194
|
addGlobalOptions(command)
|
|
195
195
|
.option('--config <path>', 'Path to prisma-next.config.ts')
|
|
196
196
|
.action(async (options: { config?: string; json?: string | boolean; quiet?: boolean }) => {
|
|
197
|
-
const flags =
|
|
198
|
-
const ui =
|
|
197
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
198
|
+
const ui = createTerminalUI(flags);
|
|
199
199
|
const result = await executeRefListCommand(options);
|
|
200
200
|
const exitCode = handleResult(result, flags, ui, (value) => {
|
|
201
201
|
if (flags.json) {
|
package/src/utils/cli-errors.ts
CHANGED
|
@@ -16,9 +16,11 @@ import {
|
|
|
16
16
|
errorDriverRequired,
|
|
17
17
|
errorFamilyReadMarkerSqlRequired,
|
|
18
18
|
errorFileNotFound,
|
|
19
|
+
errorInvalidOutputFormat,
|
|
19
20
|
errorMigrationCliInvalidConfigArg,
|
|
20
21
|
errorMigrationCliUnknownFlag,
|
|
21
22
|
errorMigrationPlanningFailed,
|
|
23
|
+
errorOutputFormatMutex,
|
|
22
24
|
errorQueryRunnerFactoryRequired,
|
|
23
25
|
errorTargetMigrationNotSupported,
|
|
24
26
|
errorUnexpected,
|
|
@@ -56,9 +58,11 @@ export {
|
|
|
56
58
|
errorDriverRequired,
|
|
57
59
|
errorFamilyReadMarkerSqlRequired,
|
|
58
60
|
errorFileNotFound,
|
|
61
|
+
errorInvalidOutputFormat,
|
|
59
62
|
errorMigrationCliInvalidConfigArg,
|
|
60
63
|
errorMigrationCliUnknownFlag,
|
|
61
64
|
errorMigrationPlanningFailed,
|
|
65
|
+
errorOutputFormatMutex,
|
|
62
66
|
errorQueryRunnerFactoryRequired,
|
|
63
67
|
errorTargetMigrationNotSupported,
|
|
64
68
|
errorUnexpected,
|
|
@@ -365,7 +365,7 @@ export function sanitizeErrorMessage(message: string, connectionUrl?: string): s
|
|
|
365
365
|
|
|
366
366
|
/**
|
|
367
367
|
* Registers the global CLI options shared by every command:
|
|
368
|
-
* --json, -q/--quiet, -v/--verbose, --trace, --color, --no-color,
|
|
368
|
+
* --format, --json, -q/--quiet, -v/--verbose, --trace, --color, --no-color,
|
|
369
369
|
* --interactive, --no-interactive, -y/--yes.
|
|
370
370
|
*
|
|
371
371
|
* Also sets up the styled help formatter.
|
|
@@ -378,7 +378,11 @@ export function addGlobalOptions(command: Command): Command {
|
|
|
378
378
|
return formatCommandHelp({ command: cmd, flags });
|
|
379
379
|
},
|
|
380
380
|
})
|
|
381
|
-
.option(
|
|
381
|
+
.option(
|
|
382
|
+
'--format <pretty|json>',
|
|
383
|
+
'Output format (default: pretty, or json when stdout is not a TTY)',
|
|
384
|
+
)
|
|
385
|
+
.option('--json', 'Output as JSON (alias for --format json)')
|
|
382
386
|
.option('-q, --quiet', 'Quiet mode: errors only')
|
|
383
387
|
.option('-v, --verbose', 'Verbose output: debug info, timings')
|
|
384
388
|
.option('--trace', 'Trace output: deep internals, stack traces')
|