是否有 npm 版本预发布标识符? [英] Are there npm version prerelease identifiers?
问题描述
有一个非常方便的npm version
命令.除了像 major
、minor
和 patch
这样的参数,它还接受像 prerelease
、prepatch
这样的参数等
它在文档中说命令按照 semver.inc
工作 函数.
There is a very handy npm version
command. Besides arguments like major
, minor
and patch
it accepts arguments like prerelease
, prepatch
, etc.
It says in the docs that the commands work in accordance with the semver.inc
function.
我对这些 pre
命令有疑问.
These pre
commands I have a question about.
假设我目前使用的是 v1.0.0
版本.
如果我运行 npm version prerelease
,它会将版本提升到 v1.0.1-0
.
Say I'm currently at version v1.0.0
.
If I run npm version prerelease
it will bump version to v1.0.1-0
.
是否可以根据 https://为预发布标识符提供额外的参数github.com/npm/node-semver#prerelease-identifiers?
我希望像 npm version prerelease alpha
这样的东西可以将版本提升到 v1.0.1-alpha.0
但这不起作用.
I wish something like npm version prerelease alpha
would bump version to v1.0.1-alpha.0
but that doesn't work.
推荐答案
从 npm 6.4.0 开始,您可以使用 npm 的
像这样:--preid
选项版本
Starting with npm 6.4.0 you can use the --preid
option of npm version
like this:
$ npm version prerelease --preid=alpha
v0.1.1-alpha.0
$ npm version prerelease --preid=alpha
v0.1.1-alpha.1
$ npm version prerelease --preid=alpha
v0.1.1-alpha.2
这篇关于是否有 npm 版本预发布标识符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!