From b06d14356c2de57bc41398b01ceb304485287831 Mon Sep 17 00:00:00 2001 From: Rico Kahler Date: Wed, 26 Jun 2024 15:58:40 -0500 Subject: [PATCH] fix(cli): allow no-confirm no-dry-run migrations (#7031) Co-authored-by: Paul Ngei --- .../cli/commands/migration/runMigrationCommand.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/sanity/src/_internal/cli/commands/migration/runMigrationCommand.ts b/packages/sanity/src/_internal/cli/commands/migration/runMigrationCommand.ts index 90944cd50b3..ab0a33ca8c3 100644 --- a/packages/sanity/src/_internal/cli/commands/migration/runMigrationCommand.ts +++ b/packages/sanity/src/_internal/cli/commands/migration/runMigrationCommand.ts @@ -186,18 +186,18 @@ const runMigrationCommand: CliCommandDefinition = { `To adjust them, launch the management interface with ${chalk.cyan('sanity manage')}, navigate to the API settings, and toggle the webhooks before and after the migration as needed.\n`, ) - const response = - flags.confirm && - (await prompt.single({ + if (flags.confirm) { + const response = await prompt.single({ message: `This migration will run on the ${chalk.yellow( chalk.bold(apiConfig.dataset), )} dataset in ${chalk.yellow(chalk.bold(apiConfig.projectId))} project. Are you sure?`, type: 'confirm', - })) + }) - if (response === false) { - debug('User aborted migration') - return + if (!response) { + debug('User aborted migration') + return + } } const spinner = output.spinner(`Running migration "${id}"`).start()