# @continuous-auth/semantic-release-npm 中文文档

规范地址：https://npmcn.com/package/%40continuous-auth/semantic-release-npm/

版本：4\.0\.0
npm 元数据更新时间：2024-08-29T20:38:50.231Z
中文译文更新时间：2026-11-10T19:51:00.212Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40continuous-auth/semantic-release-npm
原文对照：https://npmcn.com/package/%40continuous-auth/semantic-release-npm/?lang=original
项目主页：https://github.com/semantic-release/npm#readme
源码仓库：https://github.com/semantic-release/npm

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：28.9 kB，16 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- Node.js 要求：^18\.17 \|\| \>=20
- 运行依赖：14 个
- peer 依赖：semantic-release \>=20\.1\.0
- 首次发布：2019-04-27T03:24:23.449Z
- 最新版本发布：2023-10-31T06:05:46.414Z
- 近 30 天下载量：3033（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：4（近 12 个月 0 个）

## 中文简介

发布 npm 软件包的语义释放插件

## 安装

```sh
npm install @continuous-auth/semantic-release-npm
```

也可以使用：`pnpm add @continuous-auth/semantic-release-npm`、`yarn add @continuous-auth/semantic-release-npm`、`bun add @continuous-auth/semantic-release-npm`

## README

# @ 持续- auth/ 语义- 释放- npm

[**语义释放**](https://github.com/semantic-release/semantic-release) 发布一个插件 [无](https://www.npmjs.com/) 使用软件包 [非洲金融共同体](https://github.com/electron/cfa) 2FA代码.

[![npm latest version](https://img.shields.io/npm/v/@continuous-auth/semantic-release-npm/latest.svg)](https://www.npmjs.com/package/@continuous-auth/semantic-release-npm) [![npm next version](https://img.shields.io/npm/v/@contiuous-auth/semantic-release-npm/next.svg)](https://www.npmjs.com/package/@continuous-auth/semantic-release-npm)

| 步骤 | 说明 |
| --- | --- |
| `verifyConditions` | 验证是否存在 `NPM_TOKEN` 环境变量,或 `.npmrc` 文件,并验证认证方法有效. |
| `prepare` | 更新 `package.json` 版本和 [创建](https://docs.npmjs.com/cli/pack) npm包装柏油球. |
| `addChannel` | [将释放添加到 Dist- tag](https://docs.npmjs.com/cli/dist-tag)。 。 。 . |
| `publish` | [发布 npm 软件包](https://docs.npmjs.com/cli/publish) 登记. |

## 安装

```bash
$ npm install @continuous-auth/semantic-release-npm -D
```

## 使用量

插件可以在 [**语义释放** 配置文件](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration)数字 :

```json
{
  "plugins": ["@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", "@continuous-auth/semantic-release-npm"]
}
```

## 配置

### npm 注册认证

时间 [符号](https://docs.npmjs.com/about-access-tokens) 认证配置为 **所需经费** 并可以通过 [环境变量](https://npmcn.com/package/%40continuous-auth/semantic-release-npm/#readme-environment-variables)。 。 。 .

自动化令牌是推荐的,因为它们可以用于自动化工作流程,即使您的账户被配置为使用 [`auth-and-writes` 2FA级](https://docs.npmjs.com/about-two-factor-authentication#authorization-and-writes)。 。 。 .

### npm 来源

如果你正在向官方登记处公布 你的管道在 [npm 支持来源的提供者](https://docs.npmjs.com/generating-provenance-statements#provenance-limitations),npm可以配置为 [以来源出版](https://docs.npmjs.com/generating-provenance-statements)。 。 。 .

由于语义上-放行会包裹npm发布命令,因此配置出处不会被直接曝光. 相反,出处可以通过 [npm 曝光的其他配置选项](https://docs.npmjs.com/generating-provenance-statements#using-third-party-package-publishing-tools)。 。 。 . 证据专门适用于出版,所以我们的建议是: `publishConfig` 内部 `package.json`。 。 。 .

#### gitHub 动作上的 npm出处

要在 GitHub 动作 CI 上签名, 软件包出处需要以下权限 用于工作:

```yaml
permissions:
  id-token: write # to enable use of OIDC for npm provenance
```

值得注意的是,如果你使用语义 - 释放到它最充分的 一个GitHub发布,GitHub评论, 和其他特征,然后 [需要更多权限](https://github.com/semantic-release/github#github-authentication) 用于此工作:

```yaml
permissions:
  contents: write # to be able to publish a GitHub release
  issues: write # to be able to comment on released issues
  pull-requests: write # to be able to comment on released pull requests
  id-token: write # to enable use of OIDC for npm provenance
```

参见 [Npm 包出处的 GitHub 动作配方](https://semantic-release.gitbook.io/semantic-release/recipes/ci-configurations/github-actions#.github-workflows-release.yml-configuration-for-node-projects) 用于完整 CI 任务的 YAML 代码示例 .

### 环境变量

| 变量 | 说明 |
| --- | --- |
| `NPM_TOKEN` | 通过 Npm 符号创建 [npm 符号创建](https://docs.npmjs.com/getting-started/working_with_tokens#how-to-create-new-tokens) |
| `CFA_PROJECT_ID` | 关于非洲金融共同体的项目ID |
| `CFA_SECRET` | 为此寄存器配置了 CAF 上的秘密 |

### 选项

| 选项 | 说明 | 默认 |
| --- | --- | --- |
| `npmPublish` | 是否发布 `npm` 软件包。 若为 `false` 页:1 `package.json` 版本仍将更新. | `false` 若为 `package.json` [私营](https://docs.npmjs.com/files/package.json#private) 属性是 `true`, (中文(简体) ), `true` 否则. |
| `pkgRoot` | 要发布的目录路径 . | `.` |
| `tarballDir` | 用于写包沥青球的目录路径 。 若为 `false` 文件系统不保存柏油球. | `false` |

**说明**编号: `pkgRoot` 目录必须包含 `package.json`。该版本将在 `package.json` 财务报告和审定财务报表 `npm-shrinkwrap.json` 内部 `pkgRoot` 目录.

**说明**: 如果使用 [可共享配置](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/shareable-configurations.md#shareable-configurations) 定义其中之一的选项,您可以设置为 `false` 在你身边 [**语义释放** 配置](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration) 以使用默认值.

### npm 配置

该插件使用 [`npm` 国 际](https://github.com/npm/cli) 读取配置 [`.npmrc`](https://docs.npmjs.com/files/npmrc)。见 [`npm config`](https://docs.npmjs.com/misc/config) 用于选项列表.

这个 [`registry`](https://docs.npmjs.com/misc/registry) 可以通过 npm 环境变量配置 `NPM_CONFIG_REGISTRY` 并优先于 `.npmrc`。 。 。 .

这个 [`registry`](https://docs.npmjs.com/misc/registry) 财务报告和审定财务报表 [`dist-tag`](https://docs.npmjs.com/cli/dist-tag) 可以在 `publishConfig` 输入 `package.json`数字 :

```json
{
  "publishConfig": {
    "registry": "https://registry.npmjs.org/",
    "tag": "latest"
  }
}
```

**页:1**数字 :

-   存在 `.npmrc` 文件将覆盖任何指定的环境变量.
-   存在 `registry` 或者说 `dist-tag` 下级 `publishConfig` 输入 `package.json` 将优先于配置 `.npmrc` 财务报告和审定财务报表 `NPM_CONFIG_REGISTRY`

### 实例

这个 `npmPublish` 财务报告和审定财务报表 `tarballDir` 选项可以用来跳过发布到 `npm` 注册,然后用另一个插件释放包式柏油球。 例如,与 [@semantic-release/ github (英语)](https://github.com/semantic-release/github) 插件 :

```json
{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    [
      "@continuous-auth/semantic-release-npm",
      {
        "npmPublish": false,
        "tarballDir": "dist"
      }
    ],
    [
      "@semantic-release/github",
      {
        "assets": "dist/*.tgz"
      }
    ]
  ]
}
```

当从一个子目录中出版时 `pkgRoot` 选项 `package.json` 财务报告和审定财务报表 `npm-shrinkwrap.json` 使用新版本更新的可移动到另一个带有 `postversion`。例如,与 [@semantic-release/ git (英语)](https://github.com/semantic-release/git) 插件 :

```json
{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    [
      "@continuous-auth/semantic-release-npm",
      {
        "pkgRoot": "dist"
      }
    ],
    [
      "@semantic-release/git",
      {
        "assets": ["package.json", "npm-shrinkwrap.json"]
      }
    ]
  ]
}
```

```json
{
  "scripts": {
    "postversion": "cp -r package.json .. && cp -r npm-shrinkwrap.json .."
  }
}
```

## 常见问题

### @continuous-auth/semantic-release-npm 是什么？

发布 npm 软件包的语义释放插件

### 如何安装 @continuous-auth/semantic-release-npm？

在项目目录运行 npm install @continuous-auth/semantic-release-npm，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：semantic-release（\>=20\.1\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @continuous-auth/semantic-release-npm 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/continuous-auth\_\_semantic-release-npm 是否存在。

### @continuous-auth/semantic-release-npm 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @continuous-auth/semantic-release-npm 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js ^18\.17 \|\| \>=20。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @continuous-auth/semantic-release-npm 可以商用吗？

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

### @continuous-auth/semantic-release-npm 的下载量有多少？

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

### @continuous-auth/semantic-release-npm 还在维护吗？

最新版本 4\.0\.0 发布于 2023/10/31（3 年前）；至今共发布 4 个版本，其中过去 12 个月发布了 0 个；首次发布于 2019/04/27。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

