{"id":15654008,"url":"https://github.com/kt3k/license-checker","last_synced_at":"2025-04-30T22:24:40.401Z","repository":{"id":44677412,"uuid":"166519974","full_name":"kt3k/license-checker","owner":"kt3k","description":":page_facing_up: CLI tool for checking license headers in files","archived":false,"fork":false,"pushed_at":"2024-09-30T02:47:29.000Z","size":231,"stargazers_count":29,"open_issues_count":5,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-22T03:29:24.713Z","etag":null,"topics":["cli","deno","jsr","license"],"latest_commit_sha":null,"homepage":"https://jsr.io/@kt3k/license-checker","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kt3k.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-19T07:39:35.000Z","updated_at":"2025-03-13T13:00:12.000Z","dependencies_parsed_at":"2024-01-12T07:37:40.447Z","dependency_job_id":"534e6fb7-d877-45ef-ad6f-f28f739de461","html_url":"https://github.com/kt3k/license-checker","commit_stats":{"total_commits":151,"total_committers":3,"mean_commits":"50.333333333333336","dds":"0.013245033112582738","last_synced_commit":"afde25b8fae9aedce6a5148cfd3f62d641e69ac8"},"previous_names":["kt3k/deno_license_checker"],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kt3k%2Flicense-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kt3k%2Flicense-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kt3k%2Flicense-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kt3k%2Flicense-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kt3k","download_url":"https://codeload.github.com/kt3k/license-checker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251790569,"owners_count":21644240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","deno","jsr","license"],"created_at":"2024-10-03T12:48:53.124Z","updated_at":"2025-04-30T22:24:40.376Z","avatar_url":"https://github.com/kt3k.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://raw.githubusercontent.com/kt3k/license-checker/main/.github/logo.svg\" width=\"300\"\u003e\n\n# license-checker v3.3.1\n\n[![ci](https://github.com/kt3k/license-checker/actions/workflows/ci.yml/badge.svg)](https://github.com/kt3k/license-checker/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/kt3k/license-checker/branch/main/graph/badge.svg?token=pbV4Qsg70v)](https://codecov.io/gh/kt3k/license-checker)\n\nA utility for checking license headers in the files in a directory.\n\n# Usage\n\nUse via Deno:\n\n```shell\ndeno run --allow-read jsr:@kt3k/license-checker@3.3.1/main\n```\n\nUse via npx:\n\n```shell\nnpx @kt3k/license-checker\n```\n\n# Usage\n\nCreate `.licenserc.json` like the following:\n\n```json\n{\n  \"**/*.ts\": \"// Copyright 2019 My Name. All rights reserved. MIT license.\"\n}\n```\n\nThen run:\n\n```console\ndeno run --allow-read jsr:@kt3k/license-checker@3.3.1/main\n```\n\nThis checks the license lines in the files under the current directory.\n\n# `.licenserc.json`\n\nYou can use any glob pattern in the keys of `.licenserc.json`\n\n```json\n{\n  \"**/*.ts\": \"Copyright 2019 My Name. All rights reserved. MIT license.\",\n\n  \"**/*.{js,ts}\": \"This matches any .js and .ts files\",\n\n  \"*.go\": \"This matches .go file in the project root, (not in subdirectories)\",\n\n  \"src/**/*.ts\": \"This matches .ts file in `src` dir\",\n\n  \"**/*.ts\": [\n    \"You can put multiline headers like this\",\n\n    \"Copyright Foo, Inc. and other Bar contributors.\",\n\n    \"Permission is hereby granted, free of charge, to any person obtaining a\",\n    \"copy of this software and associated documentation files (the\",\n    \"\\\"Software\\\"), to deal in the Software without restriction, including\",\n    \"without limitation the rights to use, copy, modify, merge, publish,\",\n    \"distribute, sublicense, and/or sell copies of the Software, and to permit\",\n    \"persons to whom the Software is furnished to do so, subject to the\",\n    \"following conditions:\",\n    \"...\"\n  ]\n}\n```\n\n### Ignore files\n\n`ignore` property in the config file allows you to ignore certain files:\n\n```js\n{\n  \"**/*.js\": \"// Copyright 2019 My Name. All rights reserved. MIT license.\",\n\n  \"ignore\": [\n    \"lib/vendor/jquery.js\", // ignore this file\n    \"vendor/\" // ignore all files under vendor\n  ]\n}\n```\n\n`ignore` needs to be an array, not a string.\n\n### Multiple config in `.licenserc.json`\n\nYou can put multiple config in `.licenserc.json` like the below:\n\n```json\n[\n  {\n    \"*.ts\": \"Copyright main\",\n    \"ignore\": [\n      \"vendor.ts\"\n    ]\n  },\n  {\n    \"vendor.ts\": \"Copyright some vendor\"\n  }\n]\n```\n\nEach object in the main array is treated independently as a single config. This\nis useful when the some license lines overlaps the ignore pattern of the other\nconfig.\n\n# Options\n\n```\nUsage: license_checker.ts [options]\n\nOptions:\n  -h, --help               Show this help message and exit.\n  -v, --version            Show the version number and exit.\n  -q, --quiet              Don't print messages except errors.\n  -i, --inject             Inject license into head if missing.\n  -c, --config \u003cfilename\u003e  Specify config filename. Default is '.licenserc.json'.\n```\n\n# API\n\n```ts\nimport { checkLicense } from \"jsr:@kt3k/license-checker@3.3.1\";\n```\n\n## `checkLicense(configs: Config[], options: Options): Promise\u003cboolean\u003e`\n\nWhere:\n\n```ts\ntype Config = {\n  ignore?: string[];\n  config: Array\u003c[string, (string | string[])]\u003e;\n};\n\n// The tuple `[string, (string | string[])]` means\n// The pair of (globPattern, license-headers)\n// This checks whether license-headers exists files of globPattern.\n\ntype Options = {\n  inject: boolean;\n  quiet: boolean;\n  cwd: string;\n};\n```\n\nThis checks the license headers according to the given config and options.\n\n# LICENSE\n\nMIT\n\n# History\n\n- 2022-02-01 v3.2.0 Support url config.\n- 2022-01-22 v3.1.7 Update dependencies.\n- 2021-11-05 v3.1.6 Add npm support.\n- 2021-07-22 v3.1.4 Fix directory handling.\n- 2020-08-05 v3.0.3 Update for the new registry.\n- 2020-06-23 v2.0.1 Update for deno v1.1.0.\n- 2019-03-10 v1.5.0 Add --inject flag\n- 2019-03-10 v1.4.0 Update for deno v0.3.x\n- 2019-02-24 v1.3.0 Support Multiline copyright header #3\n- 2019-02-16 v1.2.0 Initial release\n\n# Development\n\nSee dev commands:\n\n```sh\ndeno task\n```\n\nRun test:\n\n```sh\ndeno task test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkt3k%2Flicense-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkt3k%2Flicense-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkt3k%2Flicense-checker/lists"}