Skip to content

Conversation

@MaxBlack-dev
Copy link
Contributor

Fixes #2788

This PR fixes the issue where npm outdated output wraps when Location or 'Depended by' columns contain long paths, making the output difficult to read.

Changes

  • Added column truncation logic to limit Location and Depended by column widths based on terminal width
  • Truncates columns that exceed calculated max width with ellipsis (...)
  • Maintains readability by ensuring output fits within terminal width

Implementation

  • Calculate available terminal width (defaults to 80 if not available)
  • Reserve space for fixed-width columns (Package, Current, Wanted, Latest)
  • Split remaining space between Location and Depended by columns
  • Truncate strings longer than max column width with '...' suffix

Testing

  • Added test case for narrow terminal width to verify truncation works correctly
  • All existing tests pass
  • 100% code coverage maintained

@MaxBlack-dev MaxBlack-dev requested a review from a team as a code owner December 9, 2025 01:33
@MaxBlack-dev MaxBlack-dev force-pushed the fix/2788-outdated-wrapping branch 2 times, most recently from e0ca198 to 35c3f34 Compare December 9, 2025 03:00
@MaxBlack-dev MaxBlack-dev reopened this Dec 19, 2025
@MaxBlack-dev MaxBlack-dev force-pushed the fix/2788-outdated-wrapping branch from 35c3f34 to a9bca19 Compare December 19, 2025 05:18
@MaxBlack-dev MaxBlack-dev force-pushed the fix/2788-outdated-wrapping branch from 7677d17 to a4f2e45 Compare December 19, 2025 06:34
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.

[BUG] npm outdated now hard to read

1 participant