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

codemetrics

v0.2.2

Published

A highly pluggable system to get stats and code metrics from your projects

Downloads

7

Readme

CodeMetrics

A highly pluggable system to get stats from your projects

:warning: This is NOT for production at this moment

Current status

POC

Goal

Provide a tool to get metrics, statistics and what you want from a static analyse of source code with all the technical stuff provided by plugins.

Anatomy of the plugin system

Codemetrics is based on a file analysis model. That means the input and work unit is the file, but thanks the plugin system you can provide data in an other way, you just have to respect input format.

                          +----------------------------------------------------------------------+
                          |                                                                      |
                          |    RUNNER                                                            |
                          |                                                                      |
                          |                                                                      |
                          |                                                                      |
   Input :                |                                                                      |
    Glob pattern          |   +-------------+         +-------------+         +-------------+    |
    Raw data              |   |             |         |             |         |             |    |
       +------------------>   |             |         |             |         |             |    +------------------>
                          |   |  Parser(s)  +---------> Processor(s)+---------> Reporter(s) |    |
                          |   |             |         |             |         |             |    |    Output :
                          |   |             |         |             |         |             |    |    Simple JSON
                          |   +-------------+         +-------------+         +-------------+    |    Nice console output
                          |                                                                      |    HTML
                          |                                                                      |    ...
                          |                                                                      |
                          |                                                                      |
                          |                                                                      |
                          +----------------------------------------------------------------------+

Data is passed from parsers to reporters in order and chained. You can provide multiple plugins in each category and combine them. Only parsers will transform data .

Rules to follow

  • Every plugin MUST have a run function which accept a data object.
  • A plugin have a unique key provided by the name of the plugin ( as written in package.json)

Plugin options

Plugins options can be passed through config file and/or CLI. For each plugin, an option object will override default. Each plugin could expose an API exepct for input and output dataCLI control

Parser plugins

It is the input point for all the data. Generally you want to analyse the files of your project but, in case you want to provide another way , this is the place to do it.

You can combine multiple parsers plugin to parse the input. Input data will be mutated throught each parser in order specified by the config.

The primary argument of the CLI is automatically provided to the parser as input.

Rules

Output format MUST be at the very minimum:

[{ data : (String) data parsed }]

It's better to provide

[{ name : (String) name of the "file", path : (String) path to the file, could be empty, data : (String) data parsed }]

Processor plugins

This is where magic append. All the analysis must be in the processors plugins. You can count the number of lines of your files , measure complexity or even parse the dependency tree.

Reporter plugins

All this data need to be nicely exposed. This is the job of reporters. You are totally free of the output format, the only things to use correctly is the data source.

With plugins, you introduce custom keys that reporters can use. This is a great opportunity to tune your reporter in order to work better with some specific plugins.

TODO > example dependcies.

Because each plugin is associated with a unique key, it is easy to adapt your reporting to just one plugin or multiples plugins.

##Logging

###Error report