@bbc/apache2-license-checker

中文文档
1.1.4发布于 2019/02/27Apache-2.0CommonJS近 30 天下载 4582

Automated license checker for validating project dependencies for compatable Apache2 licenses.

原始使用文档
文档目录5 节
  1. Use with your project
  2. Creating Exceptions
  3. license-exceptions.json
  4. Development
  5. Example output

Apache2 License Checker

Automated license checker for validating project dependencies for compatible Apache2 licenses.

Use with your project

  • Run npm install @bbc/apache2-license-checker --save-dev
  • Modify your package.json to include apache2-license-checker as part of your test script

For example:

...
  "scripts": {
    "test": "mocha && npm run check-licenses",
    "check-licenses": "apache2-license-checker"
  },
...

The license checker will fail with an exit code of 1 if there are any problems with the license, and will pass with an exit code of 0 if all checks are ok.

A temporary file licenses.json will be created containing a full license analysis based on output from the license-checker tool. You will probably want to .gitignore this file.

Creating Exceptions

If the license checker throws errors, and you've verified the errors as acceptable risks, then you may want to create an exceptions file in your local project. For example:

license-exceptions.json

{
  "exceptions": {
    "cosmos-deploy@*": {
      "reason": "Not required, acceptable use for BBC internal deployments"
    },
    "[email protected]": {
      "reason": "Public Domain; see: https://github.com/dscape/cycle/"
    },
    "[email protected]": {
      "reason": "MIT License; see: https://github.com/dominictarr/map-stream"
    },
    "[email protected]": {
      "reason": "Public Domain; see https://github.com/faisalman/ua-parser-js"
    }
  }
}

Development

To support

  • Check out the code
  • Run npm install
  • Run npm test

Modify scripts/whitelist.js to allow additional licenses or license combinations.

Modify scripts/exceptions.js to allow specific modules for a given reason.

Please push to a branch and raise a pull request, or fork and do the same.

Example output

In normal usage running npm run check-licenses produces an output similar to:

Acceptable project licenses (uses):
  (MIT AND CC-BY-3.0) (1)
  Apache-2.0 (3)
  BSD-2-Clause (1)
  BSD-3-Clause (1)
  ISC (15)
  MIT (23)
  Unlicense (1)
  WTFPL (1)

Acceptable project license exceptions:
  [email protected]
    Reason: Not required, acceptable use for BBC internal deployments
  [email protected]
    Reason: Public Domain; see: https://github.com/dscape/cycle/
  [email protected]
    Reason: MIT License; see: https://github.com/dominictarr/map-stream

All licenses ok Licensed (46) Exceptions (0) Problems (0)

If there is a problem with the licenses, then expect an output similar to:

Acceptable project licenses (uses):
  Apache-2.0 (3)
  BSD-2-Clause (1)
  BSD-3-Clause (1)
  CC-BY-3.0 (1)
  CC0-1.0 (1)
  ISC (16)
  MIT (25)

Acceptable project license exceptions:
  [email protected]
    Reason: Public Domain; see https://github.com/kemitchell/spdx-exceptions.json

Problems with the licenses for these dependencies:
  [email protected]
    License:     CC0-1.0
    Repository:  https://github.com/shinnn/spdx-license-ids
    Publisher:   Shinnosuke Watanabe
    Url:         https://github.com/shinnn


Licenses not ok Licensed (46) Exceptions (1) Problems (1)

版本与发布记录

@bbc/apache2-license-checker 共发布 5 个版本,首次发布于 2019/02/26;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.1.4latest2019/02/277 年前
1.1.32019/02/277 年前
1.1.22019/02/267 年前
1.1.12019/02/267 年前
1.1.02019/02/267 年前

关于 @bbc/apache2-license-checker 的常见问题

@bbc/apache2-license-checker 是什么?

Automated license checker for validating project dependencies for compatable Apache2 licenses.

如何安装 @bbc/apache2-license-checker?

在项目目录运行 npm install @bbc/apache2-license-checker,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 apache2-license-checker,可以用 npx apache2-license-checker 直接运行。

@bbc/apache2-license-checker 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/bbc__apache2-license-checker 是否存在。

@bbc/apache2-license-checker 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@bbc/apache2-license-checker 可以商用吗?

@bbc/apache2-license-checker 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@bbc/apache2-license-checker 的下载量有多少?

根据 npm 官方下载统计,@bbc/apache2-license-checker 在 2026/10/08 – 2026/11/06 这 30 天内被下载 4,582 次,日均约 153 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bbc/apache2-license-checker 还在维护吗?

最新版本 1.1.4 发布于 2019/02/27(7 年前);至今共发布 5 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/02/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。