Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i npm publish a "unstable" or "develop" package

Tags:

npm

In our workflow we have two git branches master and develop. We keep the master stable and the develop branch has untested work in it.

We'd like to let teams pull down the develop work with npm to test/ or if they need it and are happy with it.

However, im not sure how to publish this with npm?

We have this now:

npm info @mycompany/mypackage dist-tags
{ latest: '4.2.1-rc.1' }

What i would like to see is something like

npm info @mycompany/mypackage dist-tags
{ latest: '4.2.1-rc.1' , develop: '4.2.1'}

However, to do this i tried npm publish ./ --tag=develop and in doing so i actually get this:

npm info @mycompany/mypackage dist-tags
{ latest: '4.2.0 , develop: '4.2.1'}

That is, i'd like the latest/default to be 'latest' and if the pull the tag 'develop' they get the unstable (which is technically 'newer').

Is this the correct way of using npm for this? If not what is? And how to achieve?

like image 540
Tim Avatar asked Sep 11 '26 17:09

Tim


1 Answers

One common pattern is to explicitly set the version in package.json to be something like 4.2.0-beta, and then run npm publish --tag=develop. That way you're not essentially taking 4.2.1 forever. What you're doing above means that when you want to publish the "final" 4.2.1 you won't be able to, because the develop publish already took that version.

like image 140
Drew Schuster Avatar answered Sep 15 '26 07:09

Drew Schuster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!