Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm - release module multiple branches with multiple versions

I have a npm module which is already released under 4.x.x version and have breaking changes comparing to 3.x.x stable version.

However I have some updates to 3.x.x version and want to patch its' npm version. Is it possible? Can I manage 2 major versions on npm?

Will https://docs.npmjs.com/cli/publish npm publish --tag do the trick?

like image 448
Kosmetika Avatar asked Nov 27 '15 11:11

Kosmetika


Video Answer


1 Answers

However I have some updates to 3.x.x version and want to patch its' npm version. Is it possible? Can I manage 2 major versions on npm?

Yes, it's possible. Something that's common is to have the master branch for new developement and branch off older versions if you want to patch them and name them e.g. 3.x.

So if we assume your module has previously been released as 3.1.2 and you want to fix a bug, i.e. you want to publish 3.1.3 (patch release). Simply branch off from 3.1.2 (assuming you have a git tag v3.1.1):

git checkout v3.1.2
git checkout -b 3.x
# make changes and commit
npm version patch # will bump package.json, commit that and tag
npm publish
like image 83
ralphtheninja Avatar answered Oct 18 '22 21:10

ralphtheninja