'How to use npm version to increment the counter behind the prepatch / preid suffix

I'm trying to find out how to correctly use npm version with prepatch (also premajor or preminor) / preid options to increment the counter behind the suffix.

e.g.:

  • I have a v.0.5.22 and want to append -rc
  • I used the command npm version prepatch --preid rc
  • then I get v.0.5.23-rc.0, fine so far.
  • but the next time I'm using the same command I end up with v.0.5.24-rc.0,
  • what I want is to get v.0.5.23-rc.1 instead

How can I only increment the counter behind -rc. and keep the patch number? Or am I misunderstanding the purpose of prepatch / preid?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source