@callstack/licenses

中文文档
1.0.0发布于 2026/10/22MITTypeScriptESM + CJS构建来源已验证近 30 天下载 18.5万

API package that exposes functionalities for programmatic scanning of licenses in Node.js projects.

原始使用文档
文档目录5 节
  1. Features
  2. Installation
  3. Programmatic Usage
  4. API Documentation
  5. Contributing
Licenses

@callstack/licenses

Release Deploy Docs Unit tests - @callstack/licenses

API package that exposes functionalities for programmatic scanning of licenses in Node.js projects. It is used by the license-kit CLI tool and can be used directly in your Node.js scripts.

Features

  • 🔍 Scan and aggregate license information from your project dependencies
  • 📝 Generate license reports in a format of choice (JSON, Markdown, raw text, AboutLibraries-compatible JSON metadata)
  • 🔄 Support for both direct and transitive dependencies

Installation

npm install @callstack/licenses

Programmatic Usage

You can use @callstack/licenses programmatically in your Node.js applications. Here's a basic example of how to use it:

import {
  Types,
  generateAboutLibrariesNPMOutput,
  generateLicensePlistNPMOutput,
  renderLicenseExpression,
  scanDependencies,
} from '@callstack/licenses';
import * as md from 'ts-markdown-builder';

// apart from dependencies, also include devDependencies, but only from the root package.json;
// also, include all transitive dependencies & optional dependencies
const optionsFactory: Types.ScanPackageOptionsFactory = ({ isRoot }) => ({
  includeDevDependencies: isRoot,
  includeTransitiveDependencies: true,
  includeOptionalDependencies: true,
});

// scan dependencies of a package
const licenses = scanDependencies(packageJsonPath, optionsFactory);

// generate AboutLibraries-compatible JSON metadata
const aboutLibrariesCompatibleReport = generateAboutLibrariesNPMOutput(licenses);

// generate LicensePlist-compatible metadata
const licensePlistReport = generateLicensePlistNPMOutput(licenses, iosProjectPath);

// generate a Markdown report
const markdownString = md
  .joinBlocks(
    Object.entries(licenses)
      .flatMap(([packageKey, { name: packageName, version, author, description, license, licenseFiles, url }]) => [
        md.heading(packageName, { level: 2 }),
        '\n',
        `Version: ${version}<br/>\n`,
        url ? `URL: ${url}<br/>\n` : '',
        author ? `Author: ${author}<br/>\n\n` : '',
        licenseFiles.map(({ licenseId, file, content }) => `${licenseId ?? file}:\n\n${content}`).join('\n\n'),
        '\n',
        description ? `Description: ${description}\n` : '',
        `License: ${renderLicenseExpression(license)}`,
        '\n',
        md.horizontalRule,
      ])
      .join('\n'),
  )
  .toString();

API Documentation

The API documentation is published under: https://callstackincubator.github.io/react-native-legal/api/.

Contributing

This package is consumed by other packages in the monorepo by its build outputs, so everytime it is modified, you need to rebuild the package. This can be done once by running yarn build, or by running yarn dev to run tsc in watch mode. All this is described in the Contributing Guide.

版本与发布记录

@callstack/licenses 共发布 7 个版本,首次发布于 2025/07/10;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.0.0latest2026/10/2217 天前
0.3.32026/08/142 个月前
0.3.22026/05/275 个月前
0.3.12026/03/108 个月前
0.3.02025/08/071.3 年前
0.2.22025/07/111.3 年前

关于 @callstack/licenses 的常见问题

@callstack/licenses 是什么?

API package that exposes functionalities for programmatic scanning of licenses in Node.js projects.

如何安装 @callstack/licenses?

在项目目录运行 npm install @callstack/licenses,或使用 pnpm add / yarn add / bun add。

@callstack/licenses 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@callstack/licenses 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@callstack/licenses 可以商用吗?

@callstack/licenses 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@callstack/licenses 的下载量有多少?

根据 npm 官方下载统计,@callstack/licenses 在 2026/10/09 – 2026/11/07 这 30 天内被下载 184,973 次,日均约 6,166 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@callstack/licenses 还在维护吗?

最新版本 1.0.0 发布于 2026/10/22(17 天前);至今共发布 7 个版本,其中过去 12 个月发布了 4 个;首次发布于 2025/07/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。