Skip to content

Commit

Permalink
Prompt to confirm upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
pantheredeye committed Sep 23, 2024
1 parent d2fe56c commit aaa8dfa
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/cli/src/commands/upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -183,7 +198,7 @@ export const handler = async ({ dryRun, tag, verbose, dedupe }) => {
},
],
{
renderer: verbose && 'verbose',
renderer: verbose ? 'verbose' : 'default',
rendererOptions: { collapseSubtasks: false },
},
)
Expand Down

0 comments on commit aaa8dfa

Please sign in to comment.