Publishing npm packages with dist tags

Last month I published the next release of Bootstrap Icons, but I screwed up the distribution tags. Instead of publishing the latest release, I published the next release. That meant my actual latest release wasn’t going to be the version folks get whe…


This content originally appeared on @mdo and was authored by Mark Otto

Last month I published the next release of Bootstrap Icons, but I screwed up the distribution tags. Instead of publishing the latest release, I published the next release. That meant my actual latest release wasn’t going to be the version folks get when they updated or installed the package today because next is for upcoming pre-release versions. I’ve screwed this up in the past with Bootstrap proper, too, because I never fully understood them.

Until today, I didn’t even know these things were called distribution (dist) tags. TIL. And today I’m writing it down to remember it for next time.

So how do you use these things or fix problems like this? Turns out npm has you covered with some approachable docs, and you don’t need to release a new version or blow anything up in the process to fix a mistake like this.

npm has dist-tag with some various options to review, add, and remove these tags:

$ npm dist-tag add <pkg>@<version> [<tag>]
$ npm dist-tag rm <pkg> <tag>
$ npm dist-tag ls [<pkg>]

In this case, I had to remove the next dist tag and create a new latest dist tag. It looked like this:

$ npm dist-tag rm bootstrap-icons next
$ npm dist-tag add bootstrap-icons@1.0.0-alpha3 latest

And with that, all was well. If you need a primer on managing alpha or beta releases, check out this Medium article.


This content originally appeared on @mdo and was authored by Mark Otto


Print Share Comment Cite Upload Translate Updates
APA

Mark Otto | Sciencx (2020-04-01T00:00:00+00:00) Publishing npm packages with dist tags. Retrieved from https://www.scien.cx/2020/04/01/publishing-npm-packages-with-dist-tags/

MLA
" » Publishing npm packages with dist tags." Mark Otto | Sciencx - Wednesday April 1, 2020, https://www.scien.cx/2020/04/01/publishing-npm-packages-with-dist-tags/
HARVARD
Mark Otto | Sciencx Wednesday April 1, 2020 » Publishing npm packages with dist tags., viewed ,<https://www.scien.cx/2020/04/01/publishing-npm-packages-with-dist-tags/>
VANCOUVER
Mark Otto | Sciencx - » Publishing npm packages with dist tags. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2020/04/01/publishing-npm-packages-with-dist-tags/
CHICAGO
" » Publishing npm packages with dist tags." Mark Otto | Sciencx - Accessed . https://www.scien.cx/2020/04/01/publishing-npm-packages-with-dist-tags/
IEEE
" » Publishing npm packages with dist tags." Mark Otto | Sciencx [Online]. Available: https://www.scien.cx/2020/04/01/publishing-npm-packages-with-dist-tags/. [Accessed: ]
rf:citation
» Publishing npm packages with dist tags | Mark Otto | Sciencx | https://www.scien.cx/2020/04/01/publishing-npm-packages-with-dist-tags/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.