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

Use table to display mismatching version output #197

Merged
merged 1 commit into from
Sep 8, 2021
Merged

Use table to display mismatching version output #197

merged 1 commit into from
Sep 8, 2021

Conversation

bmish
Copy link
Owner

@bmish bmish commented Sep 8, 2021

Fixes #188.

  • Moves data into table
  • Adds summary line at top with number of dependencies that have inconsistent versions

Screenshot

Before After
Screen Shot 2021-09-08 at 9 45 00 AM Screen Shot 2021-09-07 at 5 41 05 PM

@bmish bmish added the enhancement New feature or request label Sep 8, 2021
Copy link
Collaborator

@ddzz ddzz left a comment

Choose a reason for hiding this comment

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

I think a table clutters the output too much and may add too many additional lines to the output when more features are added. The output should match what is seen with similar tools like linters and testing frameworks.

@bmish
Copy link
Owner Author

bmish commented Sep 8, 2021

The data we want to display is tabular. Tables make it easy to parse the information, and will allow us to conveniently add more information over time. In particular, I'd like to add another column containing the list of packages for each version (#187).

Many popular tools use tables to display output:

nyc code coverage from nyc mocha:

Screen Shot 2021-09-07 at 10 12 07 PM

yarn outdated:

Screen Shot 2021-09-07 at 10 10 15 PM

yarn upgrade-interactive also shows multiple tables when run in a monorepo.

The exact formatting/style of the table is something that we can tweak later if desired, but the key win here is getting the data into tabular format to start with.

@ddzz
Copy link
Collaborator

ddzz commented Sep 8, 2021

@bmish The tables in your examples have different formatting than what you have in this PR. Right now there’s one table per dependency rather than one large table for the entire report like in your example. Having one large table would reduce the number of lines of output. Additionally, the example tables span the entire width of the terminal window, whereas this implementation has variable-width tables, which seem to be a poor design choice. And the tables in the screenshots do not have lines separating each row in the table body, which reduces the total number of lines of output.

@bmish
Copy link
Owner Author

bmish commented Sep 8, 2021

Thanks for your concerns. I'll be happy to consider updates to the formatting later, but the table is needed to unblock upcoming changes. It's already a big improvement to readability and extensibility.

`${chalk.bold(obj.dependency)} has more than one version:\n${obj.versions
): string {
if (mismatchingDependencyVersions.length === 0) {
throw new Error('No mismatching versions to output.');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should an error be thrown when there are no mismatches?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes because mismatchingVersionsToOutput should only be called when there are mismatching versions (that's how the code is written now). When there are no mismatches, there is no output.

@bmish bmish merged commit ee4329c into master Sep 8, 2021
@bmish bmish deleted the table branch September 8, 2021 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display mismatching version output with a table
2 participants