You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A utility for checking license headers in the files in a directory.
Usage
Use via Deno:
deno run --allow-read jsr:@kt3k/license-checker@3.3.1/main
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:
deno run --allow-read jsr:@kt3k/license-checker@3.3.1/main
This checks the license lines in the files under the current directory.
.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 files
ignore property in the config file allows you to ignore certain files:
{"**/*.js": "// Copyright 2019 My Name. All rights reserved. MIT license.","ignore": ["lib/vendor/jquery.js",// ignore this file"vendor/"// ignore all files under vendor]}
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:
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'.