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

Remove tty-table dependency #1390

Merged
merged 5 commits into from
Jun 24, 2024
Merged

Conversation

bluwy
Copy link
Collaborator

@bluwy bluwy commented Jun 23, 2024

The tty-table dependency is only used for changeset status --verbose. The dependency has a very big dependency graph of 115 transitive dependencies with many polyfill packages.

This PR re-implements a simpler table formatting manually to remove tty-table, as I can't find a similar table printing table that would suffice the current requirements. I don't think the large dependency footprint is worth keeping it around either.

The main difference is that this PR's implementation does not shrink the table on small console widths, but I think it's a fine tradeoff for now. The shrinking behaviour also sometimes cuts off package names and changeset paths.

Before:

image image

After:

Previous refactor of table form image image

*Now updated as a list display from #1390 (comment)

image

Copy link

changeset-bot bot commented Jun 23, 2024

🦋 Changeset detected

Latest commit: e063e58

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@changesets/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codesandbox-ci bot commented Jun 23, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

codecov bot commented Jun 23, 2024

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 80.99%. Comparing base (f295b3e) to head (e063e58).

Files Patch % Lines
packages/cli/src/commands/status/index.ts 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1390      +/-   ##
==========================================
+ Coverage   80.95%   80.99%   +0.03%     
==========================================
  Files          54       54              
  Lines        2211     2210       -1     
  Branches      652      657       +5     
==========================================
  Hits         1790     1790              
+ Misses        417      416       -1     
  Partials        4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bluwy
Copy link
Collaborator Author

bluwy commented Jun 23, 2024

Looks like status/index.ts wasn't covered by tests before, so adding more lines here seem to caused more missing coverage. Should I add some sort of test to cover it?

@bluwy
Copy link
Collaborator Author

bluwy commented Jun 24, 2024

I've discussed with @jakebailey and @benmccann of some alternative table libraries:

  • cli-table3 - tradeoffs:
    • No word wrapping for small console widths
    • No direct option for table indenting (can be workaround with string manipulation)
  • table-layout - tradeoffs:
    • Larger dependency graph, but there's a PR to slim it down
    • Has a limited set of styling options

Other libraries like console-table-printer seem to also share the same or more tradeoffs of the above two libraries. Or libraries like cliui could work but they're CLI focused.

@Andarist
Copy link
Member

In a sense, the only thing that --verbose does is print the information about related changesets. The table layout is kinda nice at presenting this but maybe it's unnecessary? Can we think about a different of presenting this data that would result in a simpler code and that wouldn't suffer from wrapping limitations/complexity?

@bluwy
Copy link
Collaborator Author

bluwy commented Jun 24, 2024

Perhaps a list form like this?
image

A bit similar to non-verbose mode but with the added version and changeset files.

@Andarist
Copy link
Member

It works for me, I think. Since a lot of changesets can be related to any particular release, I wonder if this should be a bullet~ list or just a comma-delimited list. None of them is perfect as it all depends on how many packages, changesets, etc u have... Let's just roll with what u have above.

@Andarist Andarist merged commit 6a3452e into changesets:main Jun 24, 2024
6 of 7 checks passed
@github-actions github-actions bot mentioned this pull request Jun 24, 2024
@bluwy bluwy deleted the remove-tty-table branch June 24, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants