npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

library-analyzer

v0.7.0

Published

Toolset for npm package analysis and statistics report

Downloads

2

Readme

library-analyzer

Features

  • Collection of information about the libraries used in the project.
  • Collection of download statistics for the libraries.
  • Collection of Github statistics for the libraries.
  • Visualization for the library details.

Installation

npm install library-analyzer

Or use it by npx directly.

Usage

  • Run the command in the project path, and the pages with the visualization results will be generated in the library-analyzer directory.
library-analyzer
  • If always need to get data from the NPM registry, and no need for repository details, can run the following command:
library-analyzer --from-registry --skip-repo-details
  • If no need for repository details and version history, can run the following command:
library-analyzer --skip-repo-details --skip-version-history

CLI Options

--from-registry

If node_modules exists, it will get library details from node_modules by default. Explicitly set this option to obtain library details from the NPM registry, regardless of whether there is node_modules locally.

library-analyzer --from-registry

--skip-downloads

It will collect download statistics by default, explicitly set this option to skip the collection.

library-analyzer --skip-downloads

--skip-repo-details

By default, it will collect repository details including stars, forks, etc, explicitly set this option to skip the collection.

library-analyzer --skip-repo-details

--include-dev-dependencies

It will skip libraries in devDependencies by default, explicitly set this option to collect the details, but it is only valid if the library details are obtained from the NPM registry. If the library details come from the local node_modules, all libraries will be included in the collection.

library-analyzer --include-dev-dependencies

--skip-version-history

By default, it will collect version history of libraries. This option needs to be set only when the library details come from the local node_modules, because in this case, there is no version details, it needs to get the additional information. Explicitly set this option to skip the collection if you do not need it.

library-analyzer --skip-version-history

--github-token

A token is required to fetch Github statistics. The default token has a rate limit, set this option to use your own token to avoid this situation.

library-analyzer --github-token=your token

--output

By default, it will generate results in the web pages. Set this option if need to get other formats. The currently supported formats are page and json. If the value is json, the statistics file will be also generated in the library-analyzer directory.

library-analyzer --output=json

--package-json

By default, it will be analyzed based on package.json in the project root path. Set this option If need to analyze a specific file.

library-analyzer --package-json=your file

--cache-off

By default, it will cache package metadata to speed up analysis. Set this option if not needed.

library-analyzer --cache-off

Library

It can be also used as a library, the sample code is as follows:

const analyzer = require('./index');
analyzer(
  {
    skipVersionHistory: true
  }
).then(data => {
  console.log(data.packages);
});

It will return the following data:

{
  repos: ..., // information about all repositories
  downloads: ..., // download info of libraries
  options: ..., // parameters when calling this method
  packages: ..., // details of all packages
  licenseDetails: ..., // details of all licenses used in libraries
  licenseStatistics: ..., // statistics of the licenses
  osiApprovedStatistics: ...' // osiApproved statistics of the licenses
}

For more details of the data structure, please refer to the generated json file.