Skip to content

Conversation

@dreyfus92
Copy link
Contributor

@dreyfus92 dreyfus92 commented May 12, 2025

This PR adds a dependency analyzer to the CLI, enabling detailed package analysis in two ways:

Local Analysis:

  • Reports total, direct, dev, peer, optional, and bundled dependencies
  • Shows CJS/ESM counts and install size based on your installed node_modules
  • Provides clear, formatted output with dependency counts and package metadata

Tarball Analysis:

  • Reports dependency counts and install size from the tarball
  • Includes a list of files in the tarball (optional)
  • Shows a clear note that CJS/ESM stats are not available for tarballs
  • Provides package metadata from the tarball

I've also added tests for the dependency analysis utilities and improved code documentation.

Related: #2

Copy link
Collaborator

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

LGTM 👍 A couple things I notice but I don't think it's urgent since this project is still in early stages:

  1. analyze-dependencies.ts seems to import node builtin modules, so the library itself can't be used in the browser.
  2. Is the commented out // this.log lines for debugging only or wip? Maybe good to comment at the top of the file if it's the former.
  3. The dimmed messages under Tarball Analysis are a bit hard to read on my terminal
  4. The tarball files printed could be a bit long and interfere with the logging. Maybe we could add a hint like npm pack --dry-run for users to check themselves.

@dreyfus92
Copy link
Contributor Author

Thank you for the review @bluwy, I will try to address your comments on this PR so they don't get lost in time & space 😁

@dreyfus92 dreyfus92 requested review from 43081j and bluwy May 14, 2025 20:29
@dreyfus92 dreyfus92 requested a review from 43081j May 23, 2025 19:42
@dreyfus92 dreyfus92 requested a review from 43081j May 27, 2025 00:13
Copy link
Contributor

@43081j 43081j left a comment

Choose a reason for hiding this comment

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

sorry this took so long

looks good to me now. we can iterate further in new branches 👍

@43081j 43081j merged commit c3526ce into e18e:main May 28, 2025
@43081j 43081j mentioned this pull request Jun 2, 2025
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.

3 participants