Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prompt to confirm upgrade #11601

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading