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

CLI: Add "doctor" command #22236

Merged
merged 5 commits into from
Nov 22, 2023
Merged

CLI: Add "doctor" command #22236

merged 5 commits into from
Nov 22, 2023

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Apr 24, 2023

Relates to #23033

What I did

This PR adds a new command to the storybook CLI: storybook doctor. It's heavily based on the automigrations, in fact it takes two checks from the automigrations so they can be ran at any time, detached from the automigration command.

This will serve as a way to tell users to check their overall project health, such as:

  • a project contains mismatching storybook versions
  • a project contains duplicated dependencies
  • a project contains addons which are not compatible

Here's an example of a single report:

image

Another one, when versions mismatch:

image

Here's an example with multiple reports:

image

When everything is good:
image

Just like the automigrations, the doctor command also generates a log file (only if there are reports) so users can send to us for support.

How to test

  1. Run a sandbox for template, e.g. yarn task --task sandbox --start-from auto --template react-vite/default-ts
  2. Make it wrong in either ways presented above
  3. Run code/lib/cli/bin/index.js doctor from the sandbox directory

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

@yannbf
Copy link
Member Author

yannbf commented May 1, 2023

This needs a bit more love! Would love if someone reviewed it thoroughly and we worked on it a little more before we merge this.

@yannbf yannbf marked this pull request as draft August 15, 2023 07:30
@yannbf yannbf marked this pull request as ready for review November 22, 2023 14:35
@@ -0,0 +1,119 @@
import chalk from 'chalk';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file contains the content which was just moved from getMigrationSummary.ts

@@ -102,93 +100,3 @@ export function getMigrationSummary({
borderColor: hasFailures ? 'red' : 'green',
});
}

// These packages are aliased by Storybook, so it doesn't matter if they're duplicated
const allowList = [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just moved to a new file

@yannbf yannbf merged commit d2ef359 into next Nov 22, 2023
61 checks passed
@yannbf yannbf deleted the feat/sb-doctor-command branch November 22, 2023 15:54
@github-actions github-actions bot mentioned this pull request Nov 22, 2023
36 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants