npm 版本添加 alpha 后缀 [英] npm version to add alpha postfix

查看:356
本文介绍了npm 版本添加 alpha 后缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行 npm version <new version> 会影响 package.js 文件的版本,但是我想添加 -alphapostfix 到版本,但我无法,因为它没有在文档中说明,但它由 semver 本身支持.

Running npm version <new version> will bump the version of the package.js file, however i want to add -alpha postfix to the version, but i am unable to as it is not stated in the documentation, but its supported by semver itself.

实际结果:

> npm version prerelease
> v0.2.1-1

预期结果:

> v0.2.1-alpha

推荐答案

您不能自动设置 0.2.1-alpha,但是 0.2.1-alpha.0 是可能.

You cannot set 0.2.1-alpha automatically, but 0.2.1-alpha.0 is possible.

npm 支持 --preid 选项来指定预发布的前缀.它可以与 pre* 版本结合使用.

npm supports --preid option to specify the prefix of prereleases. It's available in combination with pre* versions.

示例 1. 制作下一个主要版本的 alpha:

Example 1. Make the alpha of next major version:

# 1.2.3 => 2.0.0-alpha.0
npm version premajor --preid alpha

示例 2. 将 alpha 转换为 beta:

Example 2. Bump alpha to beta:

# 2.0.0-alpha.0 => 2.0.0-beta.0
npm version prerelease --preid beta

创建预发布后,您可以使用 prerelease 参数增加数字.

Once you create a prerelease, you can increment the number using prerelease argument.

# 2.0.0-beta.0 => 2.0.0-beta.1
npm version prerelease

这篇关于npm 版本添加 alpha 后缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆