# @fluid-tools/version-tools 中文文档

规范地址：https://npmcn.com/package/%40fluid-tools/version-tools/

版本：0\.68\.0
npm 元数据更新时间：2026-10-15T19:07:22.260Z
中文译文更新时间：2026-11-15T02:11:47.607Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40fluid-tools/version-tools
原文对照：https://npmcn.com/package/%40fluid-tools/version-tools/?lang=original
项目主页：https://fluidframework.com/
源码仓库：https://github.com/microsoft/FluidFramework

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

- 包体积（解压后）：478 kB，60 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- Node.js 要求：\>=22\.22\.2
- 运行依赖：7 个
- 首次发布：2022-07-28T01:07:27.651Z
- 最新版本发布：2026-10-15T19:07:21.993Z
- 近 30 天下载量：9437（2026-10-15 至 2026-11-13，npm 官方下载统计）
- 已发布版本数：185（近 12 个月 8 个）

## 中文简介

Fluid 框架的版本工具

## 安装

```sh
npm install @fluid-tools/version-tools
```

也可以使用：`pnpm add @fluid-tools/version-tools`、`yarn add @fluid-tools/version-tools`、`bun add @fluid-tools/version-tools`

## README

# @fluid-tools/version-tools (英语)

版本工具包提供 API 和 CLI ,用于解析和转换版本编号和范围 流体框架.

-   [@fluid-tools/version-tools (英语)](https://npmcn.com/package/%40fluid-tools/version-tools/#readme-fluid-toolsversion-tools)
-   [版本计划](https://npmcn.com/package/%40fluid-tools/version-tools/#readme-version-schemes)
-   [API 概况](https://npmcn.com/package/%40fluid-tools/version-tools/#readme-general-api)
-   [CLI 使用量](https://npmcn.com/package/%40fluid-tools/version-tools/#readme-cli-usage)
-   [图标](https://npmcn.com/package/%40fluid-tools/version-tools/#readme-commands)

# 版本计划

Fluid框架包有时使用不同于标准语义版本的版本方案. 默认为新 软件包应当使用标准语义版本。 然而,还有另外两个版本方案: _内部_ 财务报告和审定财务报表 _虚拟批次_。 。 。 .

## 内部版本方案

> \[注\] Fluid框架不再使用内部版本方案. 然而,我们仍然希望为内部版本方案保存信息和工具,因为:
> 
> 1.  在兼容性测试中我们可能会遇到内部版本.
> 2.  我们可以选择在未来重新实施内部版本计划.

流体内部版本方案由两个分母"三相"组成:主/小/patch. 第一个三胞胎叫做 页:1 _公开版本_,并被存储在版本字符串中典型的 semver 位置.

第二个三胞胎叫做 _内部版本_,可见于该版本的预发部分末尾 版本字符串.

流体内部版本字符串 _永远_ 包含字符串 `internal` 在释放前的第一个位置 节.

如下例,公开版本为: `a.b.c`,而内部版本是 `x.y.z`。 。 。 .

`a.b.c-internal.x.y.z`

### API 密码

-   `isInternalVersionScheme` -- 如果字符串代表内部版本编号,则返回真实值.
-   `isInternalVersionRange` -- 如果字符串代表了内部版本范围,则返回真实性.
-   `toInternalScheme` -- 将标准semver版本字符串转换为内部版本方案.
-   `fromInternalScheme` -- 将内部版本方案字符串转换为两个标准 sembers -- -- 一个供公众使用 版本和内部版本的版本.
-   `bumpInternalVersion` ——鉴于内部版本和凸起类型,返回凸起版本.
-   `getVersionRange` -- 鉴于内部版本和约束类型,返回强制的依赖性版本范围 制约.

## 虚拟Patch版本方案

Fluid虚拟Patch版本方案仅用于1.0前包. 版本为形式:

`0.major.minorpatch`

小版本和补丁版本通过将小版本乘以1000并再添加补丁来合并 版本。 例如,对于标准铸模 `1.2.3`,虚拟Patch版本方案将产生 `0.1.2003`。 。 。 .

小版本总是从1而不是从0开始. 也就是说,主要版本3的首次发布将是 `0.3.1000`。 。 。 .

### API 密码

-   `isVirtualPatch` -- 如果字符串代表内部版本编号,则返回真实值.

# API 概况

-   `detectVersionScheme` - 给定一个版本或范围字符串,确定字符串使用的版本方案.
-   `incRange` -- 增额a _范围_ 按凸起类型(主要、次要或补丁),保持现有的制约.

# CLI 使用量

版本工具提供命令行接口( name`fluv`当直接安装时。 不过,这里列出的指令是: 也可以在流体构建和释放工具中找到(`flub`) (中文(简体) ). 使用 [oclif 插件系统](https://oclif.io/docs/plugins)。 。 。 .

```sh-session
$ npm install -g @fluid-tools/version-tools
$ fluv COMMAND
running command...
$ fluv (--version|-V)
@fluid-tools/version-tools/0.0.0
$ fluv --help [COMMAND]
USAGE
  $ fluv COMMAND
...
```

# 图标

-   [`fluv autocomplete [SHELL]`](https://npmcn.com/package/%40fluid-tools/version-tools/#readme-fluv-autocomplete-shell)
-   [`fluv help [COMMAND]`](https://npmcn.com/package/%40fluid-tools/version-tools/#readme-fluv-help-command)
-   [`fluv version VERSION`](https://npmcn.com/package/%40fluid-tools/version-tools/#readme-fluv-version-version)
-   [`fluv version latest`](https://npmcn.com/package/%40fluid-tools/version-tools/#readme-fluv-version-latest)

## `fluv autocomplete [SHELL]`

显示自动完成安装指令 .

```
USAGE
  $ fluv autocomplete [SHELL] [-r]

ARGUMENTS
  [SHELL]  (zsh|bash|powershell) Shell type

FLAGS
  -r, --refresh-cache  Refresh cache (ignores displaying instructions)

DESCRIPTION
  Display autocomplete installation instructions.

EXAMPLES
  $ fluv autocomplete

  $ fluv autocomplete bash

  $ fluv autocomplete zsh

  $ fluv autocomplete powershell

  $ fluv autocomplete --refresh-cache
```

_参见代码 : [@oclif/ plugin- auto 完成](https://github.com/oclif/plugin-autocomplete/blob/v3.2.45/src/commands/autocomplete/index.ts)_

## `fluv help [COMMAND]`

显示 fluv 的帮助 .

```
USAGE
  $ fluv help [COMMAND...] [-n]

ARGUMENTS
  [COMMAND...]  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for fluv.
```

_参见代码 : [@oclif/plugin-帮助](https://github.com/oclif/plugin-help/blob/6.2.43/src/commands/help.ts)_

## `fluv version VERSION`

在正则 semver 和 Fluid 内部版本方案之间转换版本字符串 .

```
USAGE
  $ fluv version VERSION [--json] [-t major|minor|patch|current] [--publicVersion <value>]

ARGUMENTS
  VERSION  The version to convert.

FLAGS
  -t, --type=<option>          bump type
                               <options: major|minor|patch|current>
      --publicVersion=<value>  [default: 2.0.0] The public version to use in the Fluid internal version.

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Convert version strings between regular semver and the Fluid internal version scheme.

EXAMPLES
  The version can be a Fluid internal version.

    $ fluv version 2.0.0-internal.1.0.0 --type minor

  The version can also be a semver with a bump type.

    $ fluv version 1.0.0 --type minor

  If needed, you can provide a public version to override the default.

    $ fluv version 1.0.0 --type patch --publicVersion 3.1.0

  You can use ^ and ~ as a shorthand.

    $ fluv version ^1.0.0

  You can use the 'current' bump type to calculate ranges without bumping the version.

    $ fluv version 2.0.0-internal.1.0.0 --type current
```

_参见代码 : [src/命令/版本.ts](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/src/commands/version.ts)_

## `fluv version latest`

从版本字符串列表中查找最新版本,核算Fluid内部版本方案.

```
USAGE
  $ fluv version latest -r <value>... [--json] [--prerelease]

FLAGS
  -r, --versions=<value>...  (required) The versions to evaluate. The argument can be passed multiple times to provide
                             multiple versions, or a space-delimited list of versions can be provided using a single
                             argument.
      --prerelease           Include prerelease versions. By default, prerelease versions are excluded.

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Find the latest version from a list of version strings, accounting for the Fluid internal version scheme.

EXAMPLES
  You can use the --versions (-r) flag multiple times.

    $ fluv version latest -r 2.0.0 -r 2.0.0-internal.1.0.0 -r 1.0.0 -r 0.56.1000

  You can omit the repeated --versions (-r) flag and pass a space-delimited list instead.

    $ fluv version latest -r 2.0.0 2.0.0-internal.1.0.0 1.0.0 0.56.1000
```

_参见代码 : [src/commands/版本/最上层](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/src/commands/version/latest.ts)_

## 开发者笔记

此软件包输出其构建文件到 `lib/` 改为 `dist/` 就像我们其他的包裹一样 原因是 oclif通过常规使用 lib 文件夹, 并且有 oclif 错误可以通过将内容放入 lib 来避免 。 见 例如 [https://github.com/microsoft/FluidFramework/pull/12155 页面存档备份,存于互联网档案馆](https://github.com/microsoft/FluidFramework/pull/12155)

## 贡献准则

你们可以 [贡献](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) 通过这些方式实现流体框架:

-   回答问题 [GitHub 讨论](https://github.com/microsoft/FluidFramework/discussions)。 。 。 .
-   [提交错误报告](https://github.com/microsoft/FluidFramework/issues) 并且帮助验证修正.
-   审查 [源代码更改](https://github.com/microsoft/FluidFramework/pulls)。 。 。 .
-   [贡献错误修正](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md)。 。 。 .

详细指示改为: [repo 文档](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Home.md)。 。 。 .

本项目遵循 [Microsoft 开源行为守则](https://opensource.microsoft.com/codeofconduct/)。 。 。 . 更多信息,改为: [《行为守则》经常被问到的问题](https://opensource.microsoft.com/codeofconduct/faq/)。 。 。 . 问题或评论,联系 [打开码@ microsoft.com](mailto:opencode@microsoft.com)。 。 。 .

这个项目可能包含微软项目的商标或标志,产品,或服务. 这些商标或标志的使用必须遵循微软 [商标和品牌准则](https://www.microsoft.com/trademarks)。 。 。 . 在这个项目的修改后版本中使用微软商标或标志不得造成混淆或暗示微软赞助.

## 帮助

读取 [流体框架文件](https://fluidframework.com/docs/) 用于了解流体框架概念和API.

要求提供文件未载列的资料, [创建问题](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/Submitting-Bugs-and-Feature-Requests.md)。 。 。 .

## 商标

这个项目可能包含微软项目的商标或标志,产品,或服务.

这些商标或标志的使用必须遵循微软的 [商标和品牌准则](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general)。 。 。 .

在这个项目的修改后版本中使用微软商标或标志不得造成混淆或暗示微软赞助.

## 常见问题

### @fluid-tools/version-tools 是什么？

Fluid 框架的版本工具

### 如何安装 @fluid-tools/version-tools？

在项目目录运行 npm install @fluid-tools/version-tools，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 fluv，可以用 npx fluv 直接运行。

### @fluid-tools/version-tools 支持 TypeScript 吗？

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

### @fluid-tools/version-tools 支持 ESM 还是 CommonJS？

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

### @fluid-tools/version-tools 需要什么版本的 Node\.js？

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

### @fluid-tools/version-tools 可以商用吗？

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

### @fluid-tools/version-tools 的下载量有多少？

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

### @fluid-tools/version-tools 还在维护吗？

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

