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

@wbmnky/license-report-generator

v2.3.2

Published

Generates a license report, using your bower/npm dependencies

Downloads

4,721

Readme

@wbmnky/license-report-generator

CI Build

finds and stores all dependency licenses

Install

pnpm add @wbmnky/license-report-generator

Usage

Options

{
  useDevDependencies: boolean, // defaults to 'false'
  packagePath: string,         // defaults to 'process.cwd()'
  packageName: string,         // defaults to 'package.json'
  depth: number,               // defaults to '1'
  template: string,            // defaults to the contents of assets/template.txt
}

Examples

Find licenses and write to file

const licenser = require('@wbmnky/license-report-generator');

const options = { 
  useDevDependencies: true
};

return licenser.reporter.generate(options)
                        .then(rep => rep.write(path.resolve(__dirname, 'output.md')))
                        .catch((error) => {
                          console.log(error);
                        });

Return licenses as plain object

const licenser = require('@wbmnky/license-report-generator');

const options = { 
  useDevDependencies: true,
  depth: 2
};

return licenser.reporter.generate(options)
                        .then(rep => console.log(rep.plain()))
                        .catch((error) => {
                          console.log(error);
                        });

Use with your own template

const licenser = require('@wbmnky/license-report-generator');
const fs       = require('fs');
const path     = require('path');

const options = {
  template: fs.readFileSync(path.resolve(__dirname, 'template-table.txt'), 'utf8')
};

return licenser.reporter.generate(options)
                        .then(rep => rep.write(path.resolve(__dirname, 'output.md')))
                        .catch((error) => {
                          console.log(error);
                        });

Use with default table template

const licenser = require('@wbmnky/license-report-generator');

return licenser.reporter.generate({})
                        .then(rep => rep.table())
                        .then(rep => rep.write(path.resolve(__dirname, 'output.md')))
                        .catch((error) => {
                          console.log(error);
                        });

CLI usage

license-report-generator [--table] [--depth Number|Infinity] [--template-dir path/to/templates/] [--template-file template.txt] [--out-dir path/to/output/] [--out-file license-output.md] 
CLI options
  • --table (Default: false) - use the default table template
  • --depth {number}|Infinity (Default: 1) - package depth, 0 is current project only
  • --with-dev-dependencies (Default: false) - whether to include devDependencies in the license report or not
  • --out-dir (Default: process.cwd()) - the output directory where the license file is written to
  • --out-file (Default: license-output.md) - the output filename of the license file
  • --template-dir (Default: null) - if you want to use an own template, specify the directory where to find the template
  • --template-file (Default: null) - if you want to use an own template, specify the filename of the template

Changelog

> 2.2.0

Subsequent changelogs can be found in the Releases section of this repository.

2.2.0

  • feat: Added new variable generatedAt to use in a template
  • fix: Removed Travis CI, replaced with GitHub Actions (build and publish)
  • fix: Renamed interfaces and types
  • chore: Replaced yarn with pnpm as the internal package manager
  • chore: Updated dependencies to latest versions

2.1.0

  • Added CLI option to use as a global installed npm package

2.0.0

  • Removed bower support (fallback: legacy version 0.2.0 @ npm)
  • Return all found packages as plain object, without formatting / writing to file
  • Added second example template for display as a table

License

MIT © Sebastian Roming

Credits

This is originally based on ux-license-report.