Skip to content

[DOCS] How do I get to 1.0.0-5 using increments? #124

@mik01aj

Description

@mik01aj

I tried this:

> s = require('semver')
> v='0.0.0'
'0.0.0'
> v = s.inc(v, 'premajor')
'1.0.0-0'
> v = s.inc(v, 'premajor')
'2.0.0-0'
> v = s.inc(v, 'premajor')
'3.0.0-0'
> v = s.inc(v, 'premajor')

I would expect 1.0.0-0, 1.0.0-1, 1.0.0-2 and so on -- as I can have a number of pre-releases before I do s.inc(v, 'major'), right?

Is this just my misunderstanding or is it a bug? And if this behaviour is expected, how do I get to e.g. 1.0.0-5 using the inc function? Or should I use the undocumented pre option from https://github.com/npm/node-semver/blob/master/semver.js#L457 ?

Btw, the same applies to inc with preminor or prepatch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Documentationpull request requires docs before merging

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions