Are there npm pre-release identifiers?

There is a very convenient team npm version. In addition to arguments such as major, minorand patch, it accepts type arguments prerelease, prepatchetc.
The docs say that teams work according to function semver.inc.

These commands preI have a question.

Let's say I'm in version now v1.0.0.
If I run npm version prerelease, it will update the version to v1.0.1-0.

Is it possible to provide an additional attribute for the preliminary identifier in accordance with https://github.com/npm/node-semver#prerelease-identifiers ?

I would like something like to npm version prerelease alphauninstall the version before v1.0.1-alpha.0, but that doesn't work.

+6
source share
1 answer

I looked at this recently to find out if there are any updates on this ... but it seems that everything is still the same.

No, there are no preliminary npm version identifiers supported by the npm version command. You can see the arguments of the command here: https://github.com/npm/npm/pull/12936#issuecomment-248153743

semver ( https://www.npmjs.com/package/semver ) supports what you are trying to do, so you can get the version using the command just like this:

semver <current version> -i prerelease --preid <prelease identifier>

eg:

semver 1.0.1 -i prerelease --preid alpha

will produce:

1.0.2-alpha.0

npm (, , CI), :

npm version <resulting version from semver command>

- ( ): https://github.com/semantic-release/semantic-release

, , github repo, .

+1

All Articles