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

packagediffremote

v1.0.1

Published

show diff of packages from their repositories

Downloads

3

Readme

packageDiffRemote

npm version npm downloads

The purpose of this package is to show the differences between the code in NodeJS modules/packages (which are often downloaded from NPM) and the code for NodeJS modules/packages (which is often hosted on GitHub). This module was inspired by this article: https://therecord.media/malware-found-in-coa-and-rc-two-npm-packages-with-23m-weekly-downloads/ where malware was found in two popular NPM modules/packages.

CLI

The executables provided in the executables folder allow this module/package to be used as a cli application. You will need to download the appropriate executable and configure the command yourself though (so you do not have to use the full executable path).

All of the executables were built using Node v12.16.3 and used the pkg module/package

API

This package also exposes an API which can be used in other projects.

To use the API please run the following command:

npm i packagediffremote

An example usage of the API can be seen below:

const packageDiffRemote = require('packagediffremote');

packageDiffRemote().then(function (data) {
  console.log(data);
}).catch(function (err) {
  console.error(err);
})

The method packagediffremote can take three optional parameters (in the order shown below):

folder - string - specify a folder to check (defaults to node_modules)

package - string - specify a package to check (defaults to all packages in the folder)

verbose - boolean - output additional logs

const packageDiffRemote = require('packagediffremote');

packageDiffRemote(folder, package, verbose)

The output of data (from the code sample above) will be structured as follows:

[
  {
    "file": "absolute/path/to/file",
    "diff": [
      {
        "count": 5,
        "value": "some string"
      },
      {
        "count": 1,
        "added": undefined,
        "removed": true,
        "value": "string"
      },
      {
        "count": 10,
        "added": true,
        "removed": undefined,
        "value": "different string"
      }
    ]
  }
]
To Do

Currently the only supported hosting platform is GitHub which is not ideal... Ideally this package would support more hosting platforms...