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

license-grabber

v1.0.0

Published

A utility for getting the license information from the dependencies in a Node.js project

Downloads

4

Readme

License Grabber

Version License: MIT

A command line utility for quickly collecting the license information from dependencies in a Node.js project. This tool was made with the purpose of easily being able to view, display and use your dependencies' licenses. It offers a number of different ways to format the license info, including JSON, plain text files, Markdown and HTML. There are examples in this repository of each of the output types.

Installation

npm install -g license-grabber

Note This package is intended to be used as a command line utility, and NOT imported into a JavaScript file. Therefore, to be used properly it must be installed globally (-g) via npm.

Usage

After installation, the easiest way to get started is to navigate to your Node.js project directory and run the license-grabber command in your terminal:

cd my-project
license-grabber

Replace my-project with your project directory. Once the utility completes, you will find your license_info.json file located inside the current directory where you ran the command.

Configuration

This utility comes with several different configuration options, allowing you more control over how your license info is generated. To see all the available options, run the help command or view the options section below for more information.

license-grabber --help

The output will look something like this:

license-grabber [directory] <options>

Positionals:
  directory  The root directory of the project.                                   [string] [default: "."]

Options:
  -v, --version            Show version number                                                  [boolean]
  -h, --help               Show help                                                            [boolean]
  -t, --type               The type of output file that is generated
                                           [choices: "json", "txt", "markdown", "html"] [default: "json"]
  -o, --output-path        The directory where the output file(s) will be generated
                                                                                  [string] [default: "."]
  -n, --name               The name of the output file                 [string] [default: "license_info"]
  -P, --exclude-prod       Exclude licenses from production dependencies       [boolean] [default: false]
  -D, --exclude-dev        Exclude licenses from development dependencies      [boolean] [default: false]
  -N, --skip-node-modules  Skips checking the node_modules folder              [boolean] [default: false]
  -R, --skip-registry      Skips checking the NPM registry                     [boolean] [default: false]

Examples:
  license-grabber -t html -n licenses  Create an HTML output file and give it a custom name
  license-grabber -o ./documents -D    Choose a custom output path and exclude dev dependencies

Options

type

This is the type of output file that will be generated. Currently this utility supports 4 file types: json, txt, markdown or html. The default type is json.

Note Choosing the txt type will create a directory based on the output name (-n). Inside that directory, you will find folders for each of the dependencies that contain a .txt file holding the license info. All other types create just a single output file.

output-path

This is the path of the directory where you would like the output file(s) to be generated. This path should NOT include the name of the file, as that is a separate option available (see below). The default output path is the current directory.

name

This is the name of the output file that will be generated. The default name is license_info. This name should NOT include the file type extension, as that is automatically added on by the utility when writing the output file. For example, if you run the command with these options:

license-grabber -t json -n output.json

You will end up with an output file that looks like this: output.json.json Technically, this is still a valid JSON file but is a strange way to format a file and is not recommended.

exclude-prod

This will exclude the production dependencies. These are packages listed under the dependencies section of the package.json file. The default is false, meaning production dependencies are included.

exclude-dev

This will exclude the development dependencies. These are packages listed under the devDependencies section of the package.json file. The default is false, meaning development dependencies are included.

skip-node-modules

If this option is passed, the utility will not look for a node_modules folder, and instead will go straight to checking the NPM registry for all license information. The default is false.

skip-registry

If this option is passed, the utility will not check the NPM registry for license information. The default is false.