disclosure

0.1.0 • Public • Published

Disclosure

js-standard-style

demo

Motivation

The Node.js culture is very active in creating and publishing modules for almost every imaginable need. On average, a Node.js project has a lot more dependencies than in projects with other technologies like .NET or Java. Managing those dependencies can become be overwhelming if the project has hard requirements in terms of reliability or legal. There are too many modules to approve, vetting, monitor, etc. This tool will give you an an overview of a project's dependencies, so you know what you are exposed to regarding licenses, reliability and overall risk.

Installation

$ npm i disclosure -g

Usage

$ disclosure <path>

Options

--reporter <reporter>

The only available reporter at the moment is table. More reporters should follow.

table

$ disclosure --reporter table .

Can I build my own reporter?

Sure, disclosure by default outputs JSON. So you can pipe the stdout to your custom reporter.

$ disclosure . | my-prettify-module

--licenses [licenses]

$ disclosure . --licenses "MIT,ISC,Apache-2.0"

This option let you pass a custom license whitelist instead of using the default one.

Separate the licenses by comma and use only valid SPDX licenses ids.

--licenses-file [licensesFile]

$ disclosure . --licenses-file license.json

The same functionality as described before but instead uses a file content as the license white list.

Node.js API

disclosure(projectPath, [options], callback)

projectPath should be a valid absolute or relative path. An opts object may be provided:

var opts = {
  licenses: ['MIT', 'ISC'] // Licenses whitelist - Only valid SPDX licenses ids
}

The callback will be called with an Error and results object:

var results = {
  name: '...',
  version: '1.33.7',
  sloc: {
    real: 1234
    pkg: 100
  },
  tests: {
    exists: true,
    framework: true,
    npmScript: true
  },
  license: 'MIT',
  dependencies: {...},
  dependenciesCount: 13,
  isOutdated: false,
  isDeprecated: false,
  vulnerabilities: [...],
  private: false,
  __moduleData: {
    version: '1.0.0',
    type: 'standard'
  }
}

Disclosure core

The disclosure core is two modules that you should definitely check out and those are:

  • module-data - Traverse local module data and query remote module data.
  • module-rank - Our rank formula using the data acquired by module-data

Formula breakdown

We have three areas of concern and those are:

  • Security
  • Reliability
  • License

Each has a weight of 1, so each represent roughly 33% of the final score.

Security

The criteria of Security for public modules is:

  • noVuln - This is an array of objects that comes from snyk.

For private modules, there is no criteria to evaluate.

Reliability

The criteria of Reliability for public modules is:

  • hasTests
  • isNotOutdated
  • isNotDeprecated - If this is false, the score of this area of concern is 0.

For private modules is:

  • hasTests

License

The criteria of License for public and private modules is:

  • hasLicense
  • licenseOnWhiteList

Both need to have a score of 1 to have a positive score or else the final score of this area is 0.

Readme

Keywords

none

Package Sidebar

Install

npm i disclosure

Weekly Downloads

5

Version

0.1.0

License

MIT

Last publish

Collaborators

  • ricardofbarros