Publishing a beta or alpha version to NPM
Take advantage of NPM tags
Most software has a beta version before it gets released — a version that hasn’t yet reached production readiness because it contains some experimental features.
It is quite common to have some beta test user group that uses this version, tests it, reports issues and other findings.
The same process also occurs when we develop an NPM module. So how do we deploy beta versions with NPM?
How to deploy a beta version
After we have implemented our new feature the first thing we do is to bump the version as we would also do for a regular release.
It is crucial that we add beta.0
at the end of your version. The .0
indicates which beta version it is. When we publish a new fix as beta, we will increment the .0
to .1
and so on.
So our version should, for example, look like this: 3.1.0-beta.0
.
Next we will go ahead and commit all your changes.
In addition to the commit it is always a good practice to add a git tag to our beta version. We can add a tag with git tag
3.1.0-beta.0
You can run
npm version 3.1.0-beta.0
to updatepackage.json
and create a git tag in one go (see…