Skip to content

Instantly share code, notes, and snippets.

@meszaros-lajos-gyorgy
Last active September 29, 2024 18:30
Show Gist options
  • Save meszaros-lajos-gyorgy/10014fd81072d7454db3bce9605fab9c to your computer and use it in GitHub Desktop.
Save meszaros-lajos-gyorgy/10014fd81072d7454db3bce9605fab9c to your computer and use it in GitHub Desktop.
Process on how to release snapshot/alpha/beta versions of an NPM package as I always mix up the commands

Release process

Because I always forget how this stuff works.

This document uses alpha for snapshot prefixing, but feel free to replace it with beta or any other word that suits your development cycle.

First development snapshot

  1. npm version premajor|preminor|prepatch --preid=alpha - increases the major|minor|patch version with a -alpha.0 prefix
  2. git push --follow-tags
  3. npm publish --tag alpha.0

Second and later development snapshots

  1. npm version prerelease --preid=alpha - increases the number only in the -alpha.0 prefix [1]
  2. git push --follow-tags
  3. npm publish --tag alpha.0 <-- replace the 0 with the number you got from npm version in step 1

Tip: the current version can be printed out with this command: node -p "require('./package.json').version" [2]

Example of installing an alpha version of a package

npm i <your-package>@14.0.0-alpha.2

Release

  1. npm version major|minor|patch - similarly to how it was done in the first development snapshot
  2. git push --follow-tags
  3. npm publish
  4. Go to github and create a new release

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment