-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
CLI: Improve automigration to show prompt-only migrations #20292
Conversation
id: string; | ||
promptOnly?: boolean; | ||
check: (options: CheckOptions) => Promise<ResultType | void>; | ||
prompt: (result: ResultType) => string; | ||
run: (options: RunOptions<ResultType>) => Promise<void>; | ||
run?: (options: RunOptions<ResultType>) => Promise<void>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for future improvement:
This might be better as a union of 2 types, where 1 has promptOnly: true
, and therefore has no run
method, and another with it set to false
and thus MUST have a run
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! Let's do it later
const manualFixesMessage = | ||
fixSummary.manual.length > 0 | ||
? ` | ||
${chalk.bold('Manual migrations:')}\n\n ${fixSummary.manual | ||
.map((m) => | ||
fixResults[m] === FixStatus.MANUAL_SUCCEEDED ? chalk.green(m) : chalk.blue(m) | ||
) | ||
.join(', ')} | ||
` | ||
: ''; | ||
|
||
const skippedFixesMessage = | ||
fixSummary.skipped.length > 0 | ||
? ` | ||
${chalk.bold('Skipped migrations:')}\n\n ${fixSummary.skipped | ||
.map((m) => chalk.cyan(m)) | ||
.join(', ')} | ||
` | ||
: ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the formatting on this is a bit of a nightmare, and likely only works by trial an error.
I do agree with @tmeasday that adding stories for these over time (that accurately demonstrate what is shown in the CLI ofc.) is a must-have for the future-us. Because I suspect changing something in here, will possibly change the whole formatting..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! 💪
Issue: N/A
What I did
Manual migrations are now using
promptOnly
, and provide a different title, which shows whether migrations are "auto" or "manual":Additionally, the summary provides now "skipped migrations" and "manual migrations". Manual migrations that are "accepted" will be shown in blue, and when the user selects "quit", they will be shown in red.
This PR also makes the automigration be cancellable via ctrl + C, which was not the case before (it still provides a summary at the end).
How to test
If your answer is yes to any of these, please make sure to include it in your PR.