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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@kt3k/license-checker

v3.2.2

Published

📄 CLI tool for checking license headers in files

Readme

deno_license_checker v3.2.2

ci codecov

This tool checks the license headers in the files in a git repository. You can configure which files should have which license texts with .licenserc.json.

Usage

Use via Deno:

deno run --allow-read https://deno.land/x/[email protected]/main.ts

Use via npx:

npx @kt3k/license-checker

Usage

Create .licenserc.json like the following:

{
  "**/*.ts": "// Copyright 2019 My Name. All rights reserved. MIT license."
}

Then run:

license_checker

This checks the license lines in the files in your repository.

If you prefer not to install the command globally, you can also use the following commands:

deno run --allow-read https://deno.land/x/[email protected]/main.ts

Alternatively

npx @kt3k/license-checker

.licenserc.json

You can use any glob pattern in the keys of .licenserc.json

{
  "**/*.ts": "Copyright 2019 My Name. All rights reserved. MIT license.",

  "**/*.{js,ts}": "This matches any .js and .ts files",

  "*.go": "This matches .go file in the project root, (not in subdirectories)",

  "src/**/*.ts": "This matches .ts file in `src` dir",

  "**/*.ts": [
    "You can put multiline headers like this",

    "Copyright Foo, Inc. and other Bar contributors.",

    "Permission is hereby granted, free of charge, to any person obtaining a",
    "copy of this software and associated documentation files (the",
    "\"Software\"), to deal in the Software without restriction, including",
    "without limitation the rights to use, copy, modify, merge, publish,",
    "distribute, sublicense, and/or sell copies of the Software, and to permit",
    "persons to whom the Software is furnished to do so, subject to the",
    "following conditions:",
    "..."
  ]
}

Ignore certain files

You can ignore certain files by the ignore array in config.

{
  "**/*.js": "// Copyright 2019 My Name. All rights reserved. MIT license.",

  "ignore": [
    "lib/vendor/jquery.js", // ignore this file
    "vendor/" // ignore all files under vendor
  ]
}

Note: ignore needs to be an array, not a string.

Multiple config in .licenserc.json

You can put multiple config in .licenserc.json like the below:

[
  {
    "*.ts": "Copyright main",
    "ignore": [
      "vendor.ts"
    ]
  },
  {
    "vendor.ts": "Copyright some vendor"
  }
]

Each object in the main array is treated independently as a single config. This is useful when the some license lines overlaps the ignore pattern of the other config.

Options

Usage: license_checker.ts [options]

Options:
  -h, --help               Show this help message and exit.
  -v, --version            Show the version number and exit.
  -q, --quiet              Don't print messages except errors.
  -i, --inject             Inject license into head if missing.
  -c, --config <filename>  Specify config filename. Default is '.licenserc.json'.

API

import { checkLicense } from "https://deno.land/x/[email protected]/lib.ts";

checkLicense(configs: Config[], options: Options): Promise<boolean>

Where:

type Config = {
  ignore?: string[];
  config: Array<[string, (string | string[])]>;
};

// The tuple `[string, (string | string[])]` means
// The pair of (globPattern, license-headers)
// This checks whether license-headers exists files of globPattern.

type Options = {
  inject: boolean;
  quiet: boolean;
  cwd: string;
};

This checks the license headers according to the given config and options.

LICENSE

MIT

History

  • 2022-02-01 v3.2.0 Support url config.
  • 2022-01-22 v3.1.7 Update dependencies.
  • 2021-11-05 v3.1.6 Add npm support.
  • 2021-07-22 v3.1.4 Fix directory handling.
  • 2020-08-05 v3.0.3 Update for the new registry.
  • 2020-06-23 v2.0.1 Update for deno v1.1.0.
  • 2019-03-10 v1.5.0 Add --inject flag
  • 2019-03-10 v1.4.0 Update for deno v0.3.x
  • 2019-02-24 v1.3.0 Support Multiline copyright header #3
  • 2019-02-16 v1.2.0 Initial release

Development

See dev commands:

deno task

Run test:

deno task test