From aaa8dfa626025847d61688db760f086e8513a5dc Mon Sep 17 00:00:00 2001 From: PantheRedEye Date: Mon, 23 Sep 2024 06:47:41 -0500 Subject: [PATCH] Prompt to confirm upgrade --- packages/cli/src/commands/upgrade.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/upgrade.js b/packages/cli/src/commands/upgrade.js index c0ddb00b52e8..0a31e96e80e8 100644 --- a/packages/cli/src/commands/upgrade.js +++ b/packages/cli/src/commands/upgrade.js @@ -97,6 +97,21 @@ export const handler = async ({ dryRun, tag, verbose, dedupe }) => { // structuring as nested tasks to avoid bug with task.title causing duplicates const tasks = new Listr( [ + { + title: 'Confirm upgrade', + task: async (ctx, task) => { + const proceed = await task.prompt({ + type: 'Confirm', + message: + 'This will upgrade your RedwoodJS project to the latest version. Do you want to proceed?', + initial: true, + }) + if (!proceed) { + task.skip('Upgrade cancelled by user.') + process.exit(0) + } + }, + }, { title: 'Checking latest version', task: async (ctx) => setLatestVersionToContext(ctx, tag), @@ -183,7 +198,7 @@ export const handler = async ({ dryRun, tag, verbose, dedupe }) => { }, ], { - renderer: verbose && 'verbose', + renderer: verbose ? 'verbose' : 'default', rendererOptions: { collapseSubtasks: false }, }, )