# @csmith/release-it-calver-plugin 中文文档

规范地址：https://npmcn.com/package/%40csmith/release-it-calver-plugin/

版本：2026\.9\.0
npm 元数据更新时间：2026-09-22T12:41:48.417Z
中文译文更新时间：2026-11-11T03:08:07.404Z
软件包许可：MIT

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

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

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

- 包体积（解压后）：20.6 kB，8 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- 运行依赖：1 个
- peer 依赖：release-it ^21\.0\.0
- 首次发布：2020-08-05T17:34:34.573Z
- 最新版本发布：2026-09-22T12:41:48.058Z
- 近 30 天下载量：16174（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：53（近 12 个月 18 个）

## 中文简介

Calender 版本( caval) 插件发布它 !

## 安装

```sh
npm install @csmith/release-it-calver-plugin
```

也可以使用：`pnpm add @csmith/release-it-calver-plugin`、`yarn add @csmith/release-it-calver-plugin`、`bun add @csmith/release-it-calver-plugin`

## README

# 释放-it-calver-插件

## 发布它的日历版本插件!

[![codecov](https://codecov.io/gh/casmith/release-it-calver-plugin/branch/master/graph/badge.svg?token=HKW5RKSQYW)](https://codecov.io/gh/casmith/release-it-calver-plugin)

此插件可以启用日历版本( caval) 并发布它 ! 这对在连续交付环境中的应用项目特别有用.

```
npm install --save-dev @csmith/release-it-calver-plugin
```

单位 [释出](https://github.com/release-it/release-it) 配置 :

```json
"plugins": {
  "@csmith/release-it-calver-plugin": {
    "cycle": "month"
  }
}
```

## 配置

| 选项 | 说明 | 默认 | 数值 |
| --- | --- | --- | --- |
| `cycle` | 要使用的日历周期 | `month` | `year`, (中文(简体) ), `month`, (中文(简体) ), `week`, (中文(简体) ), `day`, (中文(简体) ), `auto` |
| `prefix` | 要预置到版本的字符串 | `""` | 任意字符串 |
| `separator` | 日期段之间的分隔符 | `"."` | `"."` 或者说 `"-"` |

### 循环选项

#### `year`

版本中仅包含年份和小数字.

```
2026.0
2026.1
2027.0
```

#### `month` (默认)

版本包含年份,月份,以及一个小数字.

```
2026.3.0
2026.3.1
2026.4.0
```

#### `week`

版本包含年份,周数,还包含一个小数字.

```
2026.13.0
2026.13.1
2026.14.0
```

#### `day`

版本包含年,月,日,并有少量数字.

注:分4个部分的版本(例如:. `2026.3.24.0`)不是有效的铸模,将被拒绝 `npm version`。如果发布到 npm,则使用不同的周期或设定 `"npm": { "skipChecks": true }` 在你的释放 - 它的配置.

```
2026.3.24.0
2026.3.24.1
2026.3.25.0
```

### 前缀

用于多模块需要不同版本标记的单重机 .

```json
"@csmith/release-it-calver-plugin": {
    "cycle": "month",
    "prefix": "ui-"
}
```

制作版本像 `ui-2026.3.0`, (中文(简体) ), `ui-2026.3.1`等 (中文(简体) ).

### 分隔符

默认情况下,所有日期段由 `.` npm 的相容性。 设定为 `"-"` 以使用破折号分隔输出(卡-内在格式)。 只有在不需要 npm 兼容性时才使用 .

```json
"@csmith/release-it-calver-plugin": {
    "cycle": "month",
    "separator": "-"
}
```

制作版本像 `2026-3.0`, (中文(简体) ), `2026-3.1`等 (中文(简体) ).

Dash-separated 版本无效 semver, 因此您还需要配置放行 - it来跳过 npm 版本检查 :

```json
"npm": {
    "skipChecks": true
}
```

## 从预卡尔24x版本升级

此插件现在使用 [口径24.x](https://github.com/muratgozel/node-calver)这是卡尔弗图书馆的完整重写。 插件自动处理过渡,但有些事情需要注意.

### 自动发生的事情

-   **老套装还行.** 这个 `format`, (中文(简体) ), `increment`,以及 `fallbackIncrement` 选项已贬值,但仍被支持。 插件将它们映射到新处 `cycle` 设置并记录折旧警告。 你可以按照自己的速度升级自己的配置.
-   **旧的标签被迁移.** 以旧格式(如:. `24.11.0` 或者说 `2024.11.0`)在计算下个版本时被自动转换. 不需要人工回挂.
-   **初发版本通.** 如果您的寄存器没有先前的卡尔弗标记( 或者只有 `0.0.0` 标记,插件现在正确生成初始版本而不是返回 `0.0.0`。 。 。 .

### 什么变化

-   **4位数年.** 现在的版本总是使用4位数年. 如果您的前一个标记使用了2位数年( 例如) . `24.11.0`),下个版本将使用4位数年(例如. `2026.3.0`) (中文(简体) ).
-   **简化相接.** 这个 `format` 财务报告和审定财务报表 `increment` 选项替换为单个 `cycle` 选项。 地图见下表.

### 配置绘图

| 旧配置 | 新建配置 |
| --- | --- |
| `"format": "yy.mm.minor", "increment": "calendar"` | `"cycle": "month"` |
| `"format": "yyyy.mm.minor", "increment": "calendar"` | `"cycle": "month"` |
| `"format": "yyyy.minor", "increment": "calendar"` | `"cycle": "year"` |
| `"format": "yyyy.ww.minor", "increment": "calendar"` | `"cycle": "week"` |
| `"format": "yyyy.mm.dd.minor", "increment": "calendar"` | `"cycle": "day"` |
| `"format": "yyyy.0m.minor"` | `"cycle": "month"` |
| `"format": "yyyy.0m.0d.minor"` | `"cycle": "day"` |

### 实例升级

在此之前:

```json
"@csmith/release-it-calver-plugin": {
    "format": "yyyy.mm.minor",
    "increment": "calendar",
    "fallbackIncrement": "minor"
}
```

之后:

```json
"@csmith/release-it-calver-plugin": {
    "cycle": "month"
}
```

有关日历版本的更多信息,请访问这里: [卡尔](https://github.com/muratgozel/node-calver)

## 常见问题

### @csmith/release-it-calver-plugin 是什么？

Calender 版本\( caval\) 插件发布它 \!

### 如何安装 @csmith/release-it-calver-plugin？

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

### @csmith/release-it-calver-plugin 支持 TypeScript 吗？

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

### @csmith/release-it-calver-plugin 支持 ESM 还是 CommonJS？

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

### @csmith/release-it-calver-plugin 可以商用吗？

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

### @csmith/release-it-calver-plugin 的下载量有多少？

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

### @csmith/release-it-calver-plugin 还在维护吗？

最新版本 2026\.9\.0 发布于 2026/09/22（1 个月前）；至今共发布 53 个版本，其中过去 12 个月发布了 18 个；首次发布于 2020/08/06。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

