0

I have a private package in npm which is very frequently updated, and i want to do a minor change on one of theprevious versionsof the package.

for example my current version is 1.14.0 and i want to make change on top of 1.11.1, so that all the changes after 1.11.1 are excluded.

EDIT

versions released in between

1.11.1, 1.12.0, 1.12.1, 1.12.2, 1.13.0, 1.14.0

Is it possible? if yes how? Thanks

Amit Pandey
  • 274
  • 4
  • 16
  • 2
    It might be useful if you edited your question to show/list all the versions that have been released between `1.11.1` and your current version `1.14.0` - this would help provide further context. However, what's certain is that if you make a change to `1.11.1` it can't be released again as `1.11.1` because as [point #3](https://semver.org/#spec-item-3) in the Semver guidelines state: _"Once a versioned package has been released, the contents of that version MUST NOT be modified. Any modifications MUST be released as a new version."_ – RobC Apr 30 '20 at 12:49
  • I have updated the details – Amit Pandey Apr 30 '20 at 13:25
  • it is possible for me to make a new version on top of the old one, something like 1.11.2 – Amit Pandey Apr 30 '20 at 14:13
  • 2
    You say; _"I want to do a **minor** change"_, so I assume the change(s) you want to make to `1.11.1` result in a [MINOR](https://semver.org/#summary) change in Semver terms, i.e. they _"add functionality in a backwards compatible manner"_, however you've already released `1.12.0` - so you can't do that. If however the changes you want to make are actually a `PATCH` in Semver terms, i.e. they _"make backwards compatible bug fixes"_, then you can release it as `1.11.2`. Note, when you publish `1.11.2` to the registry it gets auto tagged _"latest"_, so you'll need to use the ... – RobC Apr 30 '20 at 14:29
  • 1
    ... [dist-tag](https://docs.npmjs.com/cli/dist-tag) command to remove the _"latest"_ distribution tag from `1.11.2` and reassign it to `1.14.0`. Also be mindful that any consumers of your package who have `^1.11.1` specified in their _package.json_ (note the default caret `^` that npm applies) they'll not get `1.11.2`, and instead they'll get `1.14.0`. Only if consumers have `~1.11.1` (note the tilde `~`) specified in their _package.json_ will they get `1.11.2`. – RobC Apr 30 '20 at 14:29
  • 2
    Seems that @RobC has already covered the NPM nuances for you. You might also want to read [this answer](https://stackoverflow.com/a/60859070/3150445) that I gave to a similar recent question. – jwdonahue May 02 '20 at 20:46
  • You're effectively branching your product. Have you considered a product name change? Something like PNameClassic. Are you planning on merging your new changes down stream of 1.14.x somewhere? – jwdonahue May 02 '20 at 20:50
  • 1
    as mentioned by @RobC i made the changes on top of last commit for 1.11.1 and form that i released 1.11.2 and that works fine as per my requirement, as these changes are not required in the 1.14.0+, this is good enough. – Amit Pandey May 04 '20 at 09:33
  • @jwdonahue this is a good post, thanks for the reference – Amit Pandey May 04 '20 at 09:35

0 Answers0