• Stars
    star
    218
  • Rank 177,566 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 10 years ago
  • Updated 16 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

create a short report about a project's dependencies (license, url etc)

license report tool

Version License: MIT

Generate a license report of the projects dependencies.

Installation

npm install -g license-report

Functionality

license-report gets the dependencies of a program or package from its package.json file and for each dependency adds the installed version, the license type and the author from the corresponding package.json file in the node_modules directory and the latest available version and other data from the (npm) registry where this package was installed from.

Prerequisites

  1. The dependencies of the project under inspection must be installed so that the node_modules directory exists in the path of the package.json file.
  2. The registry defined in the registry configuration setting must be accessible (default: 'https://registry.npmjs.org/').

Configuration

Run license-report without options:

By default, license-report outputs all licenses from dependencies, devDependencies, optionalDependencies and peerDependencies.

cd your/project/
license-report

Select dependencies:

To specify one or some dependency types, use configuration options, e.g.

license-report --only=dev
license-report --only=prod
license-report --only=prod,opt,peer

The 'only' option is a comma separated list of the dependencies to use.
Possible values are:

value segment of package.json
prod dependencies
dev devDependencies
opt optionalDependencies
peer peerDependencies

Explicit package.json:

To define the package.json to inspect, use the 'package' option.

license-report --package=/path/to/package.json

Customize a field's label:

The configurable labels are used as column headers in table / csv / html output. For html output the labels of all fields in the output must be unique.

license-report --department.label=division

Customize a fields default value:

Only applicable for the fields in the list later in this document and for "custom" fields (look for "Fields with data set in the configuration of license-report")

license-report --department.value=ninjaSquad

Use another registry:

To define the registry, the remote data for packages are fetched from, use the 'registry' option.

license-report --registry=https://myregistry.com/

Registry with authorization:

To use a npm registry that requires authorization, the option npmTokenEnvVar must contain the name of an environment variable that contains the required npm authorization token (the default name is 'NPM_TOKEN'). An example:

# if the name of the environment variable containing the bearer token for npm authorization is 'NPM_TOKEN'
license-report --registry=https://myregistry.com/ --npmTokenEnvVar=NPM_TOKEN

The name of this environment variable (in the example: 'npm_token') should not be added as an option to the license-report config file, as this implies a severe security risk, when this file is checked in into a git repository. A warning is emitted if such an option is found in the config file.

Generate different outputs:

license-report --output=table
license-report --output=json
license-report --output=csv
license-report --output=html
license-report --output=markdown

# replace default ',' separator with something else
license-report --output=csv --delimiter="|" 

# output csv headers (fields) on first row
license-report --output=csv --csvHeaders

# use custom stylesheet for html output
license-report --output=html --html.cssFile=/a/b/c.css

# see the output immediately in your browser, use hcat
license-report --output=html | hcat

When using the 'hcat' package to open the result in a browser, this package must be globally installed with npm i -g hcat.

Select fields for output:

If only a few fields are required in the output, the easiest way of selecting the fields is via --fields command line arguments.

There must be at least 2 --fields options ('name' and 'installedVersion'), otherwise license-report will throw an error.

# set options with command line arguments
license-report --output=csv --fields=name --fields=installedVersion

If more fields are needed, the best way is to use a custom config file, that contains a fields array.

# set options with command line option for custom (partial) config file
license-report --output=csv --config license-report-config.json
# example of config file for backward compatible output:
{
  "fields": [
    "department",
    "relatedTo",
    "name",
    "licensePeriod",
    "material",
    "licenseType",
    "link",
    "comment",
    "installedVersion",
    "author"
  ]
}

Besides the 'build-in' fields ("department", "name", "installedVersion", "author" "comment", "licensePeriod", "licenseType", "link", "material", "relatedTo"), any field allowed in a package.json can be used in the fields array (as "custom" field).

When using "custom" field, an element named like the "custom" field with 2 properties must be addes: "value" - the default value for this field - and "label - the "heading" for generated columns. Here is an example for adding the 'homepage' field:

  "fields": [
    "name",
    "installedVersion",
    "homepage"
  ],
  "homepage": {
    "value": 'n/a',
    "label": 'Homepage'
  }

Exclude packages:

With the 'exclude' option, single packages can be excluded from the output.

license-report --exclude=async --exclude=rc

Format output

Markdown Options

If you want to change the default markdown table look and feel, e.g. center-align the text, you have to use a custom config file (--config=license-report-config.json) and in the config file use the tablemarkConfig property.

Example config for markdown table with center-aligned content:

"output": "markdown",
"fields": [
    "department",
    "relatedTo",
    "name",
    "licensePeriod",
    "material",
    "licenseType",
    "link",
    "comment",
    "installedVersion",
    "author"
  ],
"tablemarkOptions": {
  "columns": [
    { "name" : "department", "align": "center" },
    { "name" : "relatedTo", "align": "center" },
    { "name" : "name", "align": "center" },
    { "name" : "licensePeriod", "align": "center" },
    { "name" : "material", "align": "center" },
    { "name" : "licenseType", "align": "center" },
    { "name" : "link", "align": "center" },
    { "name" : "comment", "align": "center" },
    { "name" : "installedVersion", "align": "center" },
    { "name" : "author", "align": "center" }
  ]
}

For an explanation of all available options see https://github.com/haltcase/tablemark

Screenshots

screenshot screenshot1 screenshot1

"Build-in" fields

Fields with data of the installed packages:

fieldname column title data source
name name name of the package
licenseType license type type of the license of the package (e.g. MIT)
link link link to the repository of the package
installedFrom installed from the download source for the installed package (optional field)
remoteVersion remote version latest available version of the package in the registry following defined semver range (can be different from the installed version)
installedVersion installed version installed version of the package (can be different from the remote version)
definedVersion defined version version of the package as defined in the (dev-) dependencies entry (can start with a semver range character)
latestRemoteVersion latest remote version latest version of the package available in the registry (optional field)
latestRemoteModified latest remote modified last modification date of the package in the registry (optional field)
comment comment deprecated (replaced by field 'remoteVersion'); will be removed in a future version
author author author of the package

Fields with data set in the configuration of license-report:

fieldname column title set value
department department --department.value=kessler
relatedTo related to --relatedTo.value=stuff
licensePeriod license period --licensePeriod.value=perpetual
material material / not material --material.value=material

More configuration options

See lib/config.js for more details e.g. on customizing the generated html data.

license-report uses the 'rc' package for handling configuration. So it is possible to add options to the command line, use a custom (partial) configuration file or even a default configuration file in a project.

A default project configuration file must be placed in the project root path and be named .license-reportrc. The file format is 'json'. An example looks like this:

{
  "output": "table",
  "fields": [
    "name",
    "licenseType",
    "installedVersion",
    "definedVersion",
    "remoteVersion",
    "latestRemoteVersion",
    "latestRemoteModified",
    "author"
  ]
}

To find out what configuration options are available see the /lib/config.js file in the project source.

For more 'rc' configuration details see the rc documentation.

Debug report generation

By setting the debug environment variable as follows, detailed log information is generated during the report generation. For details see the documentation of the debug package on npm.

export DEBUG=license-report*

Changelog

For list of changes and bugfixes, see CHANGELOG.md.

Contributing

The CHANGELOG.md is generated with standard-changelog (using the command npm run release).

To make this possible the commit messages must follow the conventinal commits specification.

<type>: <description>

<optional body>

The following is the list of supported types:

  • build: changes that affect build components like build tool, ci pipeline, dependencies, project version, etc...
  • chore: changes that aren't user-facing (e.g. merging branches).
  • docs: changes that affect the documentation.
  • feat: changes that introduce a new feature.
  • fix: changes that patch a bug.
  • perf: changes which improve performance.
  • refactor: changes which neither fix a bug nor add a feature.
  • revert: changes that revert a previous commit.
  • style: changes that don't affect code logic, such as white-spaces, formatting, missing semi-colons.
  • test: changes that add missing tests or correct existing tests.

To ensure the syntax of commit messages commitlint is used, triggered by husky. This feature must be activated with npm run activate-commitlint once for every local clone of license-report.

ironSource logo

More Repositories

1

node-bcat

A pipe to browser utility
JavaScript
338
star
2

node-regedit

Read, Write, List and do all sorts of funky stuff to the windows registry using node.js and windows script host
JavaScript
270
star
3

nw-ninja

A minimalistic NW.js starter project for ninjas
JavaScript
97
star
4

node-loadbalance

A collection of distilled load balancing engines
JavaScript
81
star
5

tempus-fugit

A scheduling and time utilities module that doesn't waste your time
JavaScript
70
star
6

find-port

finds an open port
JavaScript
60
star
7

node-hcat

pipe html into your browser from command line
JavaScript
48
star
8

node-dynamic-middleware

turn a connect/express middleware into a runtime replaceable, deletable middleware
JavaScript
43
star
9

qool

Qool, a leveldb backed Queue
JavaScript
42
star
10

pickpick

An A/B testing engine
JavaScript
37
star
11

catchart

Pipe something from command line to a chart in the browser
JavaScript
34
star
12

node-octofications

github feed as notifications in your desktop
JavaScript
30
star
13

redis-cluster

[DISCONTINUED] a hashring based redis cluster
JavaScript
24
star
14

darkmagic

An experimental opinionated dependency injection module
JavaScript
21
star
15

node-quick-serve

quickly start an http download server and serve a single file or a directory from command line
JavaScript
19
star
16

pluggage

A very slim framework for building pluggable code.
JavaScript
18
star
17

remote-css-select-stream

Quickly run a css selector against a remote page source from a program or cli
JavaScript
17
star
18

redshift-cli

command line for querying and managing a redshift cluster
JavaScript
15
star
19

node-digital-tree

Trie data structure
JavaScript
14
star
20

galaxya

embeddable peer 2 peer service discovery and configuration
JavaScript
13
star
21

node-loadbalance-middleware

A middleware that load balance requests between several other middlewares
JavaScript
12
star
22

node-xn

a distilled engine for creating RPC Servers/Clients
JavaScript
9
star
23

simply-wait

Simply wait for some async things to happen.
JavaScript
8
star
24

blog-automate-nwjs-ui-testing

the code for this: http://blog.yanivkessler.com/2015/03/21/automate-nwjs-ui-testing/ blog post
JavaScript
8
star
25

node-k-pipeline

Executes a bunch of callback styled functions serially
JavaScript
7
star
26

node-json-explorer

explore json objects in your browser
JavaScript
7
star
27

exponential-backoff

Opinionated exponential backoff retry driver
JavaScript
6
star
28

forkraft

a helper library for cluster api
JavaScript
6
star
29

db-stuff

db stuff
JavaScript
5
star
30

cluster-file-writer

write to a single file from all workers in your cluster
JavaScript
5
star
31

websql-sugar

something to make web sql sweeter
JavaScript
4
star
32

node-yalla

A minimalistic logging lib
JavaScript
4
star
33

node-hstacks

Build hierarchies of stacks of middlewares
JavaScript
4
star
34

node-sinopia-leveldb

a leveldb backed auth plugin for sinopia private npm
JavaScript
4
star
35

osx-notify

A osx only bash/applescript that creates a notification when a process is finished
Shell
4
star
36

pickpick-targeting-compiler

compiles targeting expressions to javascript code for pickpick engine
JavaScript
4
star
37

node-assist

a personal AI assistant
JavaScript
4
star
38

node-vhosts

A cli based vhosts server for express/connect apps
JavaScript
4
star
39

id-generator

generate unique ids
JavaScript
4
star
40

pg-schema

create a schema object by querying the metadata tables of postgresql/redshift
JavaScript
4
star
41

insert-sql-generator

create generic sql insert queries from javascript objects
JavaScript
3
star
42

s3shield

a small abstraction over several s3 providers
JavaScript
3
star
43

connect-crypto

some crypto related middlewares for connect
JavaScript
3
star
44

catgraph

pipe graph data to the browser
JavaScript
3
star
45

tokenize

personal tokenize util
JavaScript
3
star
46

node-embedding

JavaScript
3
star
47

fuzzy-math

fuzzy sets, fuzzy numbers, fuzzy fuzzy fuzzy...
JavaScript
3
star
48

serverless-onehook

one hook to rule them all
JavaScript
2
star
49

herbal

duplicate data into several streams
JavaScript
2
star
50

repl

a personal lib for building repls
JavaScript
2
star
51

maxmind-download

download maxmind databases
JavaScript
2
star
52

classgen

JavaScript
2
star
53

node-k-together

Executes a bunch of callback styled functions in parallel
JavaScript
2
star
54

isos

test the current OS // isOs('windows'), isOs('linux')
JavaScript
2
star
55

node-nmg

(my) Node Module Generator
JavaScript
2
star
56

node-async-map-limit

like Promise.all() but with limit on concurrency
JavaScript
1
star
57

monitor-url-tool

simple url monitoring tool
JavaScript
1
star
58

directory-watcher

JavaScript
1
star
59

spawn-child-process-problem

spawn-child-process-problem
JavaScript
1
star
60

schedule-aws-lambda

attach a schedule to an existing aws lambda function
JavaScript
1
star
61

node-command-queue

A command queue
JavaScript
1
star
62

ec2-util

a bunch of ec2 related utilities
JavaScript
1
star
63

digital-chain

A linked list implementation
JavaScript
1
star
64

netee

tee(1) for network traffic. duplicate traffic to several backends, reply from one
JavaScript
1
star
65

node-local-update-server

A tool that creates a local update server
JavaScript
1
star
66

darkmagic-dispel

JavaScript
1
star
67

node-csv-splitter

JavaScript
1
star
68

node-json

JavaScript
1
star
69

emitter-sniffer

takes an event emitter instance and print all events when they are fired
1
star
70

node-file-index

quickly create an in memory index of files and their content
JavaScript
1
star
71

parse-arguments

parse command line style positional and named arguments, eg. `cmd positional --name=foo`
JavaScript
1
star
72

simple-file-writer

write to a file, manage back pressure and buffering
JavaScript
1
star
73

node-search

JavaScript
1
star